Using a Linux Box for a Router with NAT
This is more or less just an example from my box, but here goes:
A box which has this in its /etc/rc.d/rc.local will end up serving as a perfectly valid router for machines connecting to it over eth1, for the 192.168.5.0 subnet.
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD -j ACCEPT -s 192.168.5.0/24
echo 1 > /proc/sys/net/ipv4/ip_forward
--
SeanNewton - 13 Mar 2008