This will help you setup your ubuntu machine as a gateway and share an internet connection with other computers.For this you firstly need 2 network cards.One connected to your dsl modem/router and the other one connected to your home network which is either a single computer or a bunch of computers connected to a hub or switch..
Consider a scenario where your dsl modem/router has an ip of 192.168.1.1 and you get an ip 192.168.1.2 from your dsl modem. so the first network card gets an ip 192.168.1.2 .. Now setup your other network card to an ip like 192.168.0.1 .. Now open Text Editor(Applications->Text Editor) and copy paste the code below

echo password | sudo -S ifconfig eth0 192.168.0.1
echo password | sudo -S iptables -A FORWARD -i eth1 -o eth0 -s 192.168.1.2 -m state --state NEW -j ACCEPT
echo password | sudo -S iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
echo password | sudo -S iptables -A POSTROUTING -t nat -j MASQUERADE
echo password | sudo -S sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

NOTE:
1)Replace password with your root password
2)in this case eth0 is connected to your home network and eth1 is connected to the dsl modem/router

Now save the file as ics.txt in your home folder
Go to Places->Home Folder .. right click on ics.txt and click on properties.. Then go to permissions and check "Allow executing file as a program"
Now just double click on ics.txt and click on RUN IN TERMINAL to launch the script to enable ICS ..

0 comments

Post a Comment