2

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?

  • Did you fix this issue already ? I am facing the same problems. – user113338 Mar 8 '12 at 6:52
  • Yes, I do, and I created a script to solve the problem pastebin.com/raw.php?i=N55xLNea – Tho Nguyen Apr 17 '13 at 22:02
0

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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