I have the next topology
The clients have a private ip 192.168.0.x
And I have two NAT servers The server 1 has an interface with the gateway for the clients with 192.168.1.254 and has an interface with the ip 189.0.0.1, this interface will be used to go out to "internet" the interfaces going to allow to the clients connect to the DNS server which going to redirect to the dns server (8.8.8.8), which will redirect to the web server (9.0.0.1)
The server 2 is the same, but it has the IP 190.0.0.1 in the second interface to go out to "internet"
Server 1 interface enp0s3 (PRIVATE GATEWAY)
address: 192.168.0.254
Server 1 interface enp0s8 (PUBLIC IP)
address: 189.0.0.1
Server 2 interface enp0s3 (PUBLIC GATEWAY)
address: 192.168.0.254
Server 2 interface enp0s8 (PRIVATE IP)
address: 190.0.0.1
To make the package forwarding I'm using iptables Server 1:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o enp0s8 -j SNAT --to 189.0.0.1
Server 2:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o enp0s8 -j SNAT --to 190.0.0.1
Using these rules I can see the page on the web server (9.0.0.1), when I try to get the IP I get the IP of the NAT servers (189.0.0.1 and 190.0.0.1) but I also need get the client IP (192.168.0.X)
How can I do It?