[CentOS] Can't get forwarding to work
neil at JAMMConsulting.com
Mon Oct 5 01:54:24 UTC 2009
I am having trouble getting port forwarding
with iptables to work.
I have this configuration:
Internet --- Linux machine --- Windows machine
The windows machine is set up to listen on
IP address 10.0.0.31
I am able to use lynx to connect to http://10.0.0.31 on
the linux machine so there is no problem going from
the linux machine to the windows machine.
I have tied a public IP address a.b.c.d to the
linux machine and entered these rules in its
/sbin/ifconfig eth0:1 $WIN_EXTERNAL_IP netmask $ETH0_NETMASK broadcast
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d $WIN_EXTERNAL_IP
--dport 80 -j DNAT --to $WIN_INTERNAL_IP:80
/sbin/iptables -A FORWARD -p tcp -i eth0 -d $WIN_INTERNAL_IP --dport 80 -j
I have this log entry at the bottom of the firewall rules:
/sbin/iptables -A FORWARD -j LOG --log-prefix "FORWARD "
When I try to go to the external IP address http://a.b.c.d from
another network, I get an error.
Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com
Will your e-commerce site go offline if you have
a DB server failure, fiber cut, flood, fire, or other disaster?
If so, ask about our geographically redundant database system.
More information about the CentOS