Team,
We have configured IP tables with forwarding request coming on eth1(public IP x.x.x.x) interface to other server. We are able to forward all requests but problem is loosing origin public IP(Source IP of user) on server 192.168.254.X
Please find configuration below:
# Generated by iptables-save v1.6.0 on Wed Sep 13 12:19:51 2017
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [8:827]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -d 192.168.254.142/32 -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.254.89
-A PREROUTING -d 192.168.254.142/32 -i eth1 -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.254.89
-A POSTROUTING -o eth1 -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Wed Sep 13 12:19:51 2017
# Generated by iptables-save v1.6.0 on Wed Sep 13 12:19:51 2017
*filter
:INPUT ACCEPT [479:52143]
:FORWARD ACCEPT [41:1856]
:OUTPUT ACCEPT [417:79506]
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A FORWARD -i eth0 -o eth1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
COMMIT
# Completed on Wed Sep 13 12:19:51 2017
Please find output of IP Rule list.
0: from all lookup local
1000: from 192.168.254.142 lookup eth1rt
1000: from 192.168.254.89 lookup eth1rt
32766: from all lookup main
32767: from all lookup default
Please update what issue to loose Source IP on server 254.89.
Any help on priority will help you.
Thanks.