Forward the Wan IP to another Wan IP without changing the source address

Posted by user195410 on Server Fault See other posts from Server Fault or by user195410
Published on 2013-10-18T01:49:48Z Indexed on 2013/10/18 10:00 UTC
Read the original article Hit count: 419

Filed under:
|
|
|
|

I have tried this case by using the NAT function in iptables but fail

example. PC A IP is 1.1.1.1 (Win7) My Server IP is 2.2.2.2 (CentOS 6.2) target Server B is 3.3.3.3 (Windows server 2003)

Flow: PC A WanIP --> My Server A --> Server B (WanIP)

My iptables rules:

1. iptables -t nat -A PREROUTING -d 2.2.2.2 -p tcp --dport 80 -j DNAT --to-destination 3.3.3.3:80
2. iptables -t nat -A POSTROUTING -d 2.2.2.2 -j MASQUERADE

finally, i can access server B website by enter 2.2.2.2:80

but when i checked the access log at Server B i found it's source address had been changed to src:2.2.2.2 dst:3.3.3.3

please help me to do how to get the real address is src:1.1.1.1 dst:3.3.3.3

© Server Fault or respective owner

Related posts about linux

Related posts about iptables