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

Topic revision: r1 - 2008-03-13 - SeanNewton
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback