I need to forward traffic coming into a cloud-provisioned Ubuntu VPS at 188.8.131.52 on port 1234 to port 5678 on local Windows computer (192.168.0.200, which is behind a router at 184.108.40.206 / 192.168.0.1), but to preserve the originating IP address. The router forwards port 5678 to the Windows machine.
When I run this on the VPS:
iptables -t nat -A PREROUTING -p tcp --dport 1234 -j DNAT --to-destination 220.127.116.11:5678 iptables -t nat -A POSTROUTING -p tcp -d 18.104.22.168 --dport 5678 -j SNAT --to-source 22.214.171.124
This works to forward the packets, but the server at 126.96.36.199 thinks everything is coming from 188.8.131.52. The originating IP is lost.
Question 1: can I accomplish what I need with just iptables on the VPS? (I think the answer is No, but I'd love to be wrong.)
Question 2: can I manipulate iptables and/or routes on the router at 184.108.40.206 to accomplish this? What do I need to add to the router's iptables, and what do I need to change in the VPS's iptables?