I have Rehat Enterprise Linux Server Release 5.5(Tikanga) with two interfaces as below

  • eth0: with public IP as xxx.xx.64.118
  • eth0:0: with public IP as xxx.xx.116.19
  • eth1: with private IP as

By default my iptable POSTROUTING chain rule is as below:

target      prot  opt source              destination
MASQUERADE  all  --  

which means it has NAT IP as IP of eth0. Now I want a specific host computer(, connected to eth1, to have source IP as that of eth0:0 (ie. xxx.xx.116.19) while connecting to internet. So I added a rule as below

iptables  -t nat -A POSTROUTING -s -o eth0 -j SNAT --to-source xxx.xx.116.19

Which added new rule above MASQUERADE as show :

target     prot opt source               destination
SNAT       all  --           to:xxx.xx.116.19
MASQUERADE  all  --  

After what I supposed was that the host having IP would have public IP xxx.xx.116.19 when connecting to the internet(checked via whatismyip.com). But it still shows the public IP of eth0(xxx.xx.64.118). The same worked well for Ubuntu. Can anybody please suggest what is the problem ?

Your Answer

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

Browse other questions tagged or ask your own question.