This is an old revision of the document!
To enable a machine to act as a gateway for a network:
echo "1" > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
Where 192.168.1.0/24 is the network which will use this machine as a gateway.
To make this permanent, on Debian/Ubuntu:
touch /etc/network/if-up.d/iptables chmod 755 /etc/network/if-up.d/iptables
And add the following the new file:
#!/bin/bash echo "1" > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
For Red Hat/Fedora:
iptables-save
Good IP Tables Tutorial: