SNAT with network alias IP RHEL 5.5
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 172.16.23.2
By default my iptable POSTROUTING chain rule is as below:
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
which means it has NAT IP as IP of eth0. Now I want a specific host
computer(172.16.23.6), 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 172.16.23.6 -o eth0 -j SNAT --to-source
xxx.xx.116.19
Which added new rule above MASQUERADE as show :
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 172.16.23.6 0.0.0.0/0 to:xxx.xx.116.19
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
After what I supposed was that the host having IP 172.16.23.6 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 ?
You have copied my question from unix.stackexchange site http://unix.stackexchange.com/questions/88182/snat-with-network-alias-ip-rhel-5-5.
ReplyDelete