Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 Truong Apr 17 '13 at 22:02
add comment

1 Answer 1

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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