Let me rephrase it.. I just need an IPtable rule to do double NAT-ting..
Host A - Host B - Host C - Host D
Host B should do both source NAT and destination NAT, so that my request from Host A reaches Host C and response from Host C reaches Host A.
In the same way, Host C should take care of requests from Host B to Host D and vice-versa.
So, basically, at end of the day, I want a request from Host A to Host D to happen, and a response from Host D to Host A to happen.
I am a little confused with where we need to use PREROUTING, POSTROUTING..
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 443 -j DNAT –to-destination 127.0.0.1:7777
iptables -A FORWARD -i eth0 -p tcp –dport 443 -j ACCEPT