its very simple to masquerade ( internet connection sharing in window’s language ) in linux with few lines of iptables and ip_forward commands.

first of all you have to flush and delete existing firewall rules which are be default bye linux .

so flush rules bye typing in terminal

iptables -F

iptables -t nat -F

iptables -t mangle -F

now delete this chanis bye

iptables -X

iptables -t nat -X

iptables -t mangle -X

now time to save iptables so type

service iptables save

service iptables restart

now all rules and chains will clear !

check it by /etc/sysconfig/iptables which has all defaults rules set to accept.

now /etc/rc.d/rc.local

and insert line

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

and then save and close.

now asuming that your internet interface is eth0 then type :

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

service iptables save

service iptables restart

note:- check your service of iptables is set to start during boot up .

or check status of your iptables service

chkconfig –list iptables

if level 5 is on then its ok othewise start service at level 5 or level 2345.