Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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 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 ?

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.