0

I'm doing a test that my clients, network 10.101.29.0/24, when try to connect to 192.168.100.100 been redirected to 10.10.10.222. This part is working, but my problem is on the answer. The answers is arriving is 10.10.10.222 and what I want is the firewall/router change back to 192.168.100.100 before to give back to the client. This is what I did on my firewall/router:

iptables -t nat -A PREROUTING -i eth1 -s 10.101.29.0/24 -d 192.168.100.100 -j DNAT --to 10.10.10.222

There is just this line, nothing more.

Here my netowrk:

10.101.29.0/24 |-> <-|10.101.29.1,172.16.50.100|-><-|172.16.50.1|-> Servers

I already tried

iptables -t nat -A POSTROUTING -o eth0 -d 10.10.10.222 -j RETURN

and

iptables -t nat -A PREROUTING -i eth1 -s 10.10.10.222 -d 10.101.29.0/24 -j DNAT --to 192.168.100.100

but nothing works.

Should I load statefull modules?

Best regars.

  • Is it possible that your reply returns to your client by different path (omitting your DNAT box)? It is not clear form me from your explanation. Where on your network is 10.10.10.222 attached? – Tomek Jun 13 '19 at 11:16
  • Hello Tomek. No, the answer always came back through the Linux machine. This iptables/router is the default gateway for 10.101.29.0/24. – Kalil Jun 13 '19 at 11:28
  • It is default gateway for OUTGOING packets. What about incoming? And again - where is 10.10.10.222 attached? – Tomek Jun 13 '19 at 11:32
  • Yes, this gateway is for OUTGOING. The 10.10.10.222 is on your DMZ. There are more two gateways. One for the 192.168.100.100 and other for 10.10.10.222. But the return path is knowing for both and always pass through this Linux. – Kalil Jun 13 '19 at 11:43
  • Provide the outputs of iptables-save -t nat and ip -4 r ls table all, and ip -4 ru ls commands from NAT box, please. – Anton Danilov Jun 13 '19 at 11:58
0

After Tomek comment I was looking for better this netowrk, I'm knew in this company, and figure out that another router were been used as reponse path. Becouse of this the client network was receiving a different IP.

Thanks for all help.

Best regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.