I have 3 machines: Router 192.168.229.4 Server 192.168.229.2 Client 192.168.229.3
on the server there is a TCP file server running on port 1234. I want to redirect all the client-server-client traffic via the router machine. Using iptables I was able to do some redirection. The client send the request and it redirect it to the router but the server answer directly to the client.
Those are the commands: On the client 192.168.229.3:
iptables -t nat -A OUTPUT -p tcp --dport 1234 -j DNAT --to-destination 192.168.229.4
On the router:
iptables -t nat -A PREROUTING -p tcp --dport 1234 -j DNAT --to-destination 192.168.229.2:1234
What should be the command to run on the server?