As I told in some previous post I’m using 3G modem on Linux to access the Internet in my computer, but today I decided to share my internet connection with my sister, yes her computer runs Linux too.
When the 3G connection is successful Linux creates a “ppp0” interface. Then I connected ethernet cross-cable between my computer and her computer. These are the steps to share connection:
On my computer (where the 3G modem is connected):
# ifconfig eth0 192.168.0.1 up # iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE # echo 1 > /proc/sys/net/ipv4/ip_forward
On her computer I just run:
# ifconfig eth0 192.168.0.2 # route add default gw 192.168.0.1
And I added in the /etc/resolv.conf:
nameserver 18.104.22.168 nameserver 22.214.171.124
Update: In some new Ubuntu versions you need to disable the ufw: $ sudo ufw disable. Other important tip on Ubuntu network config (nm-applet of NetworkManager) there is an option to share internet too.