DNAT redirection works but returns with the redirect IP

by Kalil   Last Updated June 13, 2019 11:00 AM

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.

Tags : iptables dnat


Related Questions


Updated April 23, 2015 21:00 PM

Updated August 01, 2015 14:00 PM

Updated February 26, 2017 06:00 AM

Updated May 03, 2017 03:00 AM

Updated March 20, 2019 17:00 PM