I am doing NAT traffic forwarding using iptables (1.1.1.1 => 2.2.2.2) with the following commands:
iptables -t nat -A PREROUTING -d 1.1.1.1 -j DNAT --to-destination 2.2.2.2
iptables -t nat -A POSTROUTING -d 2.2.2.2 -j SNAT --to 1.1.1.1
It works fine except for one thing: If I check apache logs, doing firewall rules etc. on server 2.2.2.2, it looks like all traffic is comming from 1.1.1.1.
Of course it makes a bit sense, since it is 1.1.1.1 that is forwarding the traffic to 2.2.2.2, but I assumed NAT would pass the original IP "requestor" in the package?
Is there a way to make the traffic to 2.2.2.2 have the "real" orignal IP?
Currently, it makes it very difficult to setup good firewall rules and other security stuff as ALL traffic seems to be comming from 1.1.1.1 regardless what the original traffic is actually comming from.