You don't _want_ to have the 2.xx.xxx.xxx.38 alias on the internal server!
(Read "don't _want_" as "must not"!)
I'd do
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.2
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to-source 2.xx.xxx.xxx.37
(SNAT is preferred to MASQUERADE when using static IPs as it is faster)
HTH,
-XoF-
Main Topics
Browse All Topics





by: 5733133Posted on 2003-06-11 at 10:06:31ID: 8701430
You might want to set up 2XX.XXX.XXX.38 as a virtual interface (eth0:0)
then make your rules:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0:0 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp -d 2xx.xxx.xxx.38 --dport 80 -j DNAT --to 192.168.0.2
otherwise only the DNS (or /etc/hosts) knows where to direct traffic bound for 2xx.xxx.xxx.38
use ifconfig to make a virtual interface, like so...
ifconfig eth0:0 2xx.xxx.xxx.38 netmask 255.255.255.0
5733133