Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

6. Simple IP Masquerading

To allow sharing of your internet conenction you can eitehr use a proxy server or IP Masquerading. I'll cover IP Masquerding as it's simple to set up on the other client machines. I use a 2.4.x generation kernel and in effect I use IPTables. If you use a 2.2.x or 2.0.x kernel then you need the IP Masquerading HOWTO.

This part of the HOWTO assumes that your Netfilter software is modularised, if it isnt then no big deal, either ignore the modprobe lines or recompile your kernel.

Simple now, just run the commands:

modprobe iptable_nat

iptables -t nat -F POSTROUTING

iptables -t nat -A POSTROUTING -o ppp0 -s 10.0.0.0/16 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward

Note: The space between 1 and > is vital. It seems not to activate the IP Forwarding if the space is not there.

Change the ppp0 and/or the 10.0.0.0/16 for your relevant network settings and put that file either before the case "$1" in in the internet file or somewhere in your startup.