Internet sharing using IPTABLES
Scenario : There are two pcs. one is connected directly to internet and you wish to have another one too.
You can use Squid - Proxy for that. But there is another smart way to do the same. yes use, IPTABLES !
:) here is how.....
You need to have "rOOt access.
1) edit the file:
/etc/sysctl.config
add a 1 to the ip_forward like so:
net/ipv4/ip_forward = 1
save and close file.
2) at the prompt type:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Then at the prompt again type:
/etc/init.d/iptables save
or
service iptables save
Restart the network services, like so:
/etc/init.d/network restart
or
service network restart
All this is done on the firewall machine.
The eth0 is the network interface pointing to the Internet not your local network
This will let all pc on the local net to get online and the main pc will masquerade the internal IP address to look like the request is comming from the firewall pc.
:) enjoy....

