I'm trying to configure my network to receive an incoming connection on one device and then redirect it to another device on a specific port. Right now I'm on about port 80 and a device running apache. The problem I'm facing is that when the forwarding is done it also sets the source ip to the first device instead of the source ip the user that connects to the service has.
Let me illustrate it:
[Internet User] =
connects to [Device 1] =
[Device 1] forwards it to [Device 2] =
[Device 2] outputs response that [Internet User] sees
So on [Device 2] I will naturally see [Device 1]s IP in the logs, but I wanna see if there is a way to connect the internet user through [Device 1] to [Device 2] while seeing the real source IP in the logs on [Device 2].
Is that possible?
My rule-set looks like this at the moment: (on Device 1)
iptables -P FORWARD ACCEPT iptables -t nat -I PREROUTING -j DNAT -p tcp --dport 80 --to-destination 188.8.131.52:80 iptables -t nat -I POSTROUTING -j SNAT -p tcp -d 184.108.40.206 --to-source 220.127.116.11
On [Device 2] it accepts all incoming on port 80 from [Device 1] as well as accepts all related and established connections.
So, would there be any way to get the real source onto [Device 2]?
Let me know if you need more information!