December 18, 2008

How to share your Internet connection on Ubuntu

Filed under: Connectivity,Uncategorized — Bigbrovar @ 1:23 am

For many moons ever since i started using Linux i have always wanted an easy way to share my internet connections between two computers. anyway i finally found a way to get it to work. Now i can share internet connection between my work laptop and my personally laptop.

Please while it might be possible on some other laptops. my laptop came with the PRO/Wireless 3945ABG and its impossible to share my internet over wireless because the current driver for my device doesnt support master mode which is what is needed for this to be possible. But with this guide it would be possible to share intenet via Lan. so if you get your intenet connection over wlan or a 3g modem or anything modem. it would be possible to share that same internet over Lan. Note if you got your wifi to work through ndiswrapper then we are also in the same shoes and sharing via wifi wont work. Infact this post is not about sharing your internet via wifi period.

Ok enough talk. To get started we would need tool packages. Firestarter and dhcp both can be installed with this command

sudo apt-get install firestarter dhcp3-server

Next we need to configure the internal Network Card that other computers get their internet from. In my case since the shaing computer gets internet from Wifi my internal network card (i.e the card other computers would be getting their internet from) would be eth0. we need to configure the card and assign a static IP address in a range that you will use for your internal network card. so rightclick on the Network manager applet and select edit

click the wired tab and select Auto eth0 (or the card of the particular card you want to coonfigure as the sharing interface) and click edit.


now select IPv4 Settings and choose Manual. now Add

and set it up to your preference. for example i set like this IP address to, and the subnet mask to Leave the gateway empty.

Now we need to fix a problem where firestarter cannot locate the DHCP daemon script

so we open a terminal and run this command

sudo ln -sf /etc/init.d/dhcp3-server /etc/init.d/dhcpd

Next we configure the interface that DCHP will be listening to.

To do this we need to edit this file /etc/default/dhcp3-server

gksu gedit /etc/default/dhcp3-server

only variable in there by default is “INTERFACES”, which will have a null value. Set it to your internal network interface. For example:

# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp3-server by the maintainer scripts

# This is a POSIX shell fragment

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. “eth0 eth1”.

save and exit

Now we run Firestarter Applications/Internet/Firestarter

A wizard should appear Select your Detected Device (Internet-connected) if your sharing computer gets its Internet via wifi then your external device would mostly be wlan0. if you are connected via a modem then it would be ppp0 device when it asks, and make sure to specify whether or not the address is obtained via DHCP. Click the “Forward” button, check the “Enable Internet connection sharing” box, select your internal network card,”Start firewall now” box, Then click on Preference and and Network settings.

“Enable DHCP for local network”. Drop down the “DHCP server details” and enter the range of IPs you would like for it to dynamically assign. Make sure they are in the same range as the static IP you set for your internal network card. You can leave the DNS field as “” Click “Forward”, check the “Start firewall now” box, and click “Save”.

“Enable DHCP for local network”. Drop down the “DHCP server details” and enter the range of IPs you would like for it to dynamically assign. Make sure they are in the same range as the static IP you set for your internal network card. You can leave the DNS field as “” Click “Forward”, check the “Start firewall now” box, and click “Save”.

At this stage am able to ping the from the other computer but am unable to access the internet. to fix this we need to add “net.ipv4.ip_forward = 1” to /etc/sysctl.conf

to /etc/sysctl.conf

gksu gedit /etc/sysctl.conf

and add this at the bottom

net.ipv4.ip_forward = 1
save and close.

now if all goes well you will be able to share your Internet to another laptop or computer. hope this helps some body

To share your internet using your wireless connection use this guide


  1. Awesome! Xbox 360 via wifi, for free! Thank you so much.
    To others: This took me a while because I didn’t read all of the directions first. It would have gone a lot faster if I did.

    Thanks again!


    Comment by John — December 29, 2008 @ 10:23 pm | Reply

  2. Shouldn’t the IP address in Network manager, wired tab, IPv4 Settings be , just for consistency ?

    This would be because the Firestarter comment stated “Make sure they are in the same range as the static IP you set for your internal network card.”


    Comment by Peter — January 8, 2009 @ 2:02 pm | Reply

  3. […] in Connectivity I wrote a guide earlier on how to share your internet connection on ubuntu. But the guide was  for non wireless sharing . well here is an updated version that allows you to […]

    Pingback by Share You Internet wirelessly on Ubuntu « bigbrovar — January 17, 2009 @ 2:23 pm | Reply

  4. This totally works. Well done brov!

    Comment by Ugo — February 8, 2009 @ 8:17 pm | Reply

  5. It works, it really works! And really simple, too. Thanks very much for posting 😀

    One thing is unclear to me: where you set, what is this IP referring to? Are we making it up at this point? Is it the new dhcp?..

    Also a little word to the wayward journeyman: I hit some errors starting apt-get installing dhcp server and again starting it (and “eth0 is not ready yet” is what firewall reported) until I rebooted. This is likely due to other, unrelated updates I had done..

    Comment by bronius — February 11, 2009 @ 3:51 am | Reply

  6. Oh one more thing: I’ve successfully set up DirecTV On Demand using your instructions above 😀

    Comment by bronius — February 11, 2009 @ 3:52 am | Reply

  7. Ahhh I cant get it to work… it always says “device eth0 not ready” when starting firestarter.. cannot find the source of the problem… also I cannot set the range for the dhcp in firestarter.. it always reverts to keep existing DHCP…

    Comment by Dan — February 22, 2009 @ 10:16 pm | Reply

  8. For me, at least, that’s when a restart of the machine landed me back in the right again..

    Comment by bronius — February 23, 2009 @ 12:18 am | Reply

  9. Dan,
    you need to make sure that the eth0 interface is up before starting the firewall. You can either do ifconfig eth0 or edit your /etc/network/interfaces to add the static setup before starting the firewall.

    Comment by priyesh — February 26, 2009 @ 9:47 pm | Reply

  10. thanks a ton man.. i was fighting on this thing from long back..
    thanks for posting.. 🙂

    Comment by Saurabh Gupta — April 10, 2009 @ 10:34 pm | Reply

  11. @Saurabh Gupta glad it worked for you 🙂

    Comment by Bigbrovar — April 10, 2009 @ 11:08 pm | Reply

  12. Works Great! Quick and easy. I tried another guide and this is way simpler.

    Comment by J — June 15, 2009 @ 7:36 pm | Reply

  13. I’ve look at both howto’s .
    Could you not use dnsmasq to feed eth0?
    If so how?
    They set up pfsense at the charity I work for.
    I can get on but it screws up my net installs. So feeding an ad hoc install subnet from a laptop is a boon.

    Comment by grundygreen — July 26, 2009 @ 11:35 pm | Reply

  14. BRAVO – The steps are revealed – I find it interesting that you need to set up a net sharing a SAMBA file with assigned IP addresses before even thinking about getting going with internet connection sharing – Installing firestarter and DHCP3-server on the same command line at least insured repository compatibility – The Gedit commands worked – I AM HAPPY – It works…

    Comment by zandoval — August 30, 2009 @ 8:40 pm | Reply

  15. THANK YOU SO MUCH!!!!! NOW I HAVE A HOME NETWORK SET UP FROM UBUNTU!!!! Finally a replacement to windows server. ewwww!!! windows.. win-blows. lol

    Comment by chris s — October 2, 2009 @ 8:25 am | Reply

  16. THANK YOU SO MUCH!!!!! NOW I HAVE A HOME NETWORK SET UP FROM UBUNTU!!!! Finally a replacement to windows server. ewwww!!! windows.. win-blows.

    Comment by chris s — October 2, 2009 @ 8:26 am | Reply

  17. Firestarter doesn’t work for me.

    Comment by Rohel — October 5, 2009 @ 10:26 pm | Reply

  18. Nevermind I got Firestarter to work but it won’t locate my wireless connection

    Comment by Rohel — October 5, 2009 @ 11:15 pm | Reply

  19. After doing all of this when I load Firestarter I get a message saying that the firewall could not be started because eth0 is not ready, I tried rebooting and I followed everything very precisely. Any ideas why this is happening?

    Comment by Mike — November 26, 2009 @ 12:14 pm | Reply

    • Worked like a charm, doumo arigatou.

      “After doing all of this when I load Firestarter I get a message saying that the firewall could not be started because eth0 is not ready, I tried rebooting and I followed everything very precisely. Any ideas why this is happening?”

      I got the same but that was because there was nothing connected to eth0, check to see if the other machine is connected.

      Comment by Michael — December 1, 2009 @ 8:40 am | Reply

  20. Great Article! It works wonder. Make sure you follow everything though 🙂

    Comment by ZackVixACD — December 20, 2009 @ 2:22 pm | Reply

  21. Thanks a ton, its my first day using linux and it took me hours upon hours but only because I misread initially.

    Comment by Zeke — December 25, 2009 @ 11:15 pm | Reply

  22. Thanks so much… i tried and tried to get ics working, with your help i made it…it’s great i still can’t believe it…all the best from Cologne…

    Comment by PranaBoy — January 20, 2010 @ 2:31 am | Reply

  23. First of all, a big thanks goes out to you for this simple tutorial!
    I’m a new Ubuntu user (and loving it) and was having the hardest time
    getting the Internet Connection Sharing to work when both of my machines
    were booted into Ubuntu (after my better half seen my Ubuntu installation
    and how fast it was, she just had to have it too).

    Now we’re both wondering why we didn’t make the switch years ago when we
    first heard of it. LOL Anyway, being that my configuration is a little
    screwy since the router I’m using is actually a DSL modem/router (wired
    and/or wireless capable, of which I’m using wired), but I don’t have DSL,
    I have Cable internet), so I did expect to have a bit of a hard time
    sharing the internet connection (it’s even troublesome in Windows XP),
    but I didn’t expect it to take me 4 long, mostly sleepless nights & days
    to get the task accomplished.

    I had read tons of other tutorials, trying everything I thought would help.
    I was exhausting every angle I could manage. Much of which was out-dated
    (unbeknownst to me) and I ended up getting everything so screwed up that I
    simply reformatted and started the entire installation over. I knew that I
    had a bunch of junk that I didn’t need but wasn’t sure how to get rid of the
    stuff at the time. Not to mention, being that I did this without much sleep,
    I couldn’t recall what all I had done. So to be on the safe side, I went
    ahead and did a fresh install.

    Then I found this site, followed the instructions and was in business.
    The only problem I’m having now is that for some reason when I first boot
    up, my network connections are a bit screwy and I have to disconnect one
    and reconnect. Let me explain… this machine has 2 ethernet cards.

    eth0 is connected to the Cable Internet Modem and labeled as Auto Internet 1
    eth1 is connected to the ActionTec router and is labeled as Auto Ethernet 1

    However, when I first boot up, BOTH eth0 and eth1 are started and labeled as
    Auto Internet 1 and the other machine (which is also connected to the ActionTec
    router) cannot reach the Internet. The IP addresses are assigned correctly and
    everything for all the connections, but it simply doesn’t allow the other PC
    Internet access upon boot up.

    I can’t figure out how to permanently fix this, I’ve tried completely deleting
    both connections on the server machine (the one connected to the internet) and
    trying to start fresh, but that doesn’t seem to help at all. I can’t seem to get
    rid of this behavior regardless of what I name either connection and how many times
    I try to delete and recreate the connections.

    On a good note, all I usually have to do to get the other PC reconnected is
    to left click on my network connections and then click on the “Auto Ethernet 1”
    Label tied to eth1. This disconnects the second “Auto Internet 1” Connection
    (which is also somehow connected to eth1) and Connects to eth1 labeled
    “Auto Ethernet 1”. I can’t figure out how to make it so that “Auto Ethernet 1”
    is the ONE & ONLY option for eth1 to connect as so I don’t have this issue each
    time I reboot.

    The strange thing is that sometimes doing the above alone isn’t enough to get the
    client machine online. Then I also have to disconnect and then reconnect the network
    connection on the client machine and then (again only sometimes) start FireStarter
    and completely rerun the wizard anew, including going back into the Network settings
    and selecting “Create new DHCP Configuration” even though it is already selected and
    the IP range is still correct. And in fact, sometimes I will have to go through the
    FireStarter wizard two or three times for it to take effect.

    Okay, one more thing and I’ll quit bothering you nice folks.

    I’ve just recently noticed that the FireStarter GUI is no longer loading at boot up
    consistently (sometimes it does, sometimes it doesn’t). More interestingly, it doesn’t
    always seem to be affecting the ICS when the FireStarter GUI doesn’t start. In fact,
    it “seems” like as long as it doesn’t load during boot up, I only have to do the one
    step in order to make sure the client machine can reach the internet….

    Left click on the network connections (arrows) and select “Auto Ehternet 1”.

    So I guess I’m wondering if FireStarter is actually starting (in the background
    maybe?) and I’m just not seeing it because the GUI itself isn’t loading?

    So, at least now I’m always able to get online with BOTH machines while BOTH are booted
    into Ubuntu. Whereas at one point I could only get online with BOTH machines if Ubuntu
    was booted on one and Windows and the other (didn’t seem to matter which machine was
    booted into which OS either), but simply could not get online with both when both were
    logged into Ubuntu at the same time.

    Again, thanks a million for the wonderful tutorial that Finally got me sharing my
    internet connection. I just wish I’d found it earlier. 😀

    Comment by Matt — August 29, 2010 @ 10:35 am | Reply

  24. Cable Internet is still the best compared to DSL because of the use of shilelded cables ”

    Comment by Dry Scalp Treatment : — October 31, 2010 @ 1:09 pm | Reply

  25. what i like about cable internet is that it is almost immune to electrical noise which always degrades DSL lines -“.

    Comment by ATX Power Supply — November 24, 2010 @ 5:09 pm | Reply

  26. wow that was some serious howto. it works like a charm! thanks a million ! I’m sharing a wireless broadband internet from my phone through bluetooth to the wired network O.o I’m on my ass!

    Comment by adrien — December 1, 2010 @ 4:45 pm | Reply

  27. Thanks so much for putting up this page, I had gotten as far as having the client pinging ok but net getting on to the web, the IP Forwarding step mentioned here did the trick.

    Comment by LostNetworker — December 5, 2010 @ 8:45 pm | Reply

  28. hi, how do i share my usb internet connection wirelessly. Please help

    Comment by kince — March 27, 2011 @ 11:33 am | Reply

  29. i can’t share internet connection, I was searching for this article whole day.
    Thanks for sharing.

    Comment by Mikheil — July 2, 2011 @ 11:09 pm | Reply

  30. this is nonsense..if you can connect your other laptop thru wifi then why the hassle of setting up a connection? you have connected your 1st laptop thru wifi then you should be able also to connect your 2nd laptop thru wifi, that is if your 2nd laptop is wifi-capable device, if not then this guide is for you…

    Comment by anonymous — July 4, 2011 @ 9:52 am | Reply

  31. I wanted to leave a simple comment to mention that the website was awesome. I came across it on google search just after dealing with plenty of other information which was not really related. I think I might find this much before thinking about how very good the content is.

    Comment by Crispin — September 15, 2011 @ 6:02 am | Reply

  32. thanks for sharing this information and sharing my internet connection 🙂

    Comment by Visio Viewer — January 31, 2012 @ 7:21 pm | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: