Aario's blog about life and technology

Archive for October, 2011

Internet Connection Sharing on Kubuntu 11.04

Guys, This is the easiest how to:

I have one DSL modem and some computers connected together trough a HUB Switch. One of the computers with some some IP address connects to Internet trough DSL modem. For some reasons it uses pppoeconf for configuring and using DSL connection. It’s connected to HUB Switch using eth0 as ethernet card and with some static IP address.

By the way, I downloaded a package called ipmasq which had been removed from Ubuntu 11.04 synaptic repositories from here. After installing it using GDebi and by double clicking on it and entering my password, I ran these commands:

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

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

apt-get install dnsmasq

/etc/init.d/dnsmasq restart

dpkg-reconfigure ipmasq

Here I selected default answer for all questions, except that in the last question told it to bring it up after all network services started. Then:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
nano /etc/sysctl.conf

It opened some editor in terminal, and there I found a line like:

#net.ipv4.ip_forward=1

And removed the “#” sign at beginning of it to uncomment it. Saved the file with Ctrl+O and exited using Ctrl+X. Then simply rebooted my PC. After that, whenever this computer is connected to internet, others can connect as well using its IP as their DNS and Gateway address. Any question?

PS: And here is my desktop with Kubuntu 11.04