Thio4linux

- Open Source World -

Archive for October 14th, 2007

Share internet connection on Linux

Posted by thio4linux on October 14, 2007

How to connect 2 linux pc with a sharing connection

you should have 2 network interfaces:
- one directly connected to internet (i use ppp0 in this tutorial)
- and the other for the connection of the 2 pc (i use ethernet eth0)

on the pc connected to internet (the “server”):
sudo ifconfig eth0 192.168.100.1 up
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
sudo sh -c “echo 1 > /proc/sys/net/ipv4/ip_forward”

and then look at the resolv.conf file: gedit /etc/resolv.conf

on the other pc (“client”):
sudo ifconfig eth0 192.168.100.x (substitute x with a number from 2 to 255)
sudo route add default gw 192.168.100.1

then open the resolv.conf file and add here the address that you have find on the server pc.
enjoy your shared connection!!!

Posted in internet | 1 Comment »