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

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 =

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

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

Please help :(...

  • is NOT an external IP. It's part of the IP range 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 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, is the external network. is the private network. – qwr qwr Apr 17 '12 at 20:44

Try something like:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE --to

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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