I have a situation that can be described as bellow:

CentOS A: 11.22.33.44(eth0 - WAN network) --- 5.11.22.33 (ham0 - Hamachi)

Win32 B: 55.66.77.88 (WAN network) ---- 5.11.22.44 (hamachi)

I use iptables to forward port 80 from A to B, so that people can access web server of 5.11.22.44 from 11.22.33.44

iptables -t nat -A PREROUTING --dst 11.22.33.44 -i eth0 -p tcp --dport 80 -j DNAT --to-destination 5.11.22.33:80
iptables -t nat -A POSTROUTING -p tcp --dst 5.11.22.33 --dport 80 -j SNAT --to-source 11.22.33.44

But it did not.

If I change the forward target to an ip that not in hamachi network, but in the WAN network, in this example: 55.66.77.88. It works perfectly.

Please tell me which part that I'm wrong?

link|improve this question
Did you fix this issue already ? I am facing the same problems. – rolf Mar 8 at 6:52
feedback

1 Answer

I'm trying to do something similar and it's working fine.

Could you try to set these rules:

iptables -t nat -A PREROUTING --dst 11.22.33.44 -i eth0 -p tcp --dport 80 -j DNAT --to-destination 5.11.22.44:80

iptables -t nat -A POSTROUTING -p tcp --dst 5.11.22.44 --dport 80 -j SNAT --to-source 5.11.22.33
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.