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.

So I have a private network and there is a host with ip = 10.20.111.2
and there is a firewall for this host which has ip = 10.20.111.1 And of course i has external network , host ip =10.10.111.107

So i would like my external host to ping the private host and private host reply. After that, the external host will examine the ping packet and should find the private host has a IP address = 10.10.111.1

And i used the command on the firewall: -iptables -F -iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 10.10.111.1

but when i examine the echo from the external machine, the packet from the private network still has source address = 10.20.111.2 ..which means my command doesn't work.

Please help :(...

share|improve this question
    
10.10.111.107 is NOT an external IP. It's part of the IP range 10.0.0.0/8 reserved for private use. See tools.ietf.org/html/rfc1918 and iana.org/assignments/ipv4-address-space/ipv4-address-space.xml –  aseq Apr 17 '12 at 19:46
    
@aseq I don't think qwr is implying that it's public IP space, merely that 10.10.111.107 is external relative to the other subnet in question: 10.20.111.n –  Wesley Apr 17 '12 at 20:02
    
Possibly, it's hard to determine considering the way it was phrased. –  aseq Apr 17 '12 at 20:39
    
Sorry, 10.10.111.0/24 is the external network. 10.20.111.0/24 is the private network. –  qwr qwr Apr 17 '12 at 20:44

1 Answer 1

Try something like:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE --to 10.10.111.1
share|improve this answer

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.