I was able to forward 80 port from my primary server 192.168.90.1 to the second one 192.168.90.2 with IPTABLES
The primary server has a public address X.X.X.X
so I forwarded X.X.X.X:80 -> 192.168.90.2:80
My problem is that the second server consider that all traffic coming from Internet is from 192.168.90.1 (all remote addresses are 192.168.90.1 and not the real address of clients exp: will show 192.168.90.1 instead of the client IP )
Is there somebody who faced this problem? I need to fix it without using a reverse proxy solution
This is how I forward my packets:
iptables -A PREROUTING -t nat -d X.X.X.X -p tcp --dport 80 -j DNAT --to-destination 192.168.90.2:80
iptables -t nat -A POSTROUTING -d 192.168.90.2 -p tcp --dport 80 -j SNAT --to X.X.X.X