Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

At home I have a Windows desktop - and one of the primary reasons I boot into it is to share my internet connection over the home wireless network. I have a setup of this kind:

Windows Desktop <--------> Wireless Router <--------> Mac/Linux Laptop
(plugged in USB
Internet device)

I have configured Windows to share its Internet connection over the network, using Windows Internet Connection Sharing. Instead of Windows I'd like to do the same in Ubuntu, but I gather that Linux does not share internet connections with other PCs like Windows does. What alternative do I have on Ubuntu?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Ubuntu has all the packages to be a full-fledged router. You can run the primary computer as if it is a broadband router which will provide the Internet connection to all the other computers.

https://help.ubuntu.com/community/Internet/ConnectionSharing has a lot of detailed information about how to configure such an Internet sharing configuration.

share|improve this answer
    
some pointers will help... I used to dabble with networking on linux a long time ago. I was looking for some specific stuff - which settings to tweak, where to echo 1 in the proc filesystem to enable IP forwarding (yeah, all that has receded into the nether regions of my head). Hopefully I don't need to play with iptables? Any specific configuration needed in the wireless router to talk to this broadband router so that these two routers forward packets correctly to and fro from the external interface. –  Sudhanshu Aug 6 '10 at 20:22
    
well you need to do something with the ip-tables in order to do the correct nat masquerading. However, you can probably easily do this with a firewall package like shorewall –  txwikinger Aug 6 '10 at 20:36
    
exactly what I didn't want to muck around with immediately. Maybe some day. iptables + nat masquerading == vacation project. Windows should do till then. :) –  Sudhanshu Aug 6 '10 at 20:57
    
I was able to get internet connection sharing working using tcpdump, and network manager's InternetConnectionSharing. The only trick involved was to share the desktop interface which was connected to WRT45G internet port, and add a default gateway on the desktop pointing to the internet interface. That started the DHCP server on the shared desktop interface, and gave an IP address to WRT45G's internet port interface, apart from configuring iptables automatically. –  Sudhanshu Aug 7 '10 at 16:40
    
Thanks. Followed the steps under the heading "GUI Method via Network Manager (Ubuntu 9.10 and up)" in help.ubuntu.com/community/Internet/ConnectionSharing. It worked. Using Ubuntu 12.04 and Tata Photon+ to connect to internet. Created a WEP shared network. –  Sathish May 12 '12 at 19:13

So, the desktop has the mobile modem and an ethernet connection to the wireless router? And you want to run Ubuntu on the desktop and share the 3G connection over ethernet and ultimately over wireless?

Desktop

  • Make sure the 3G connection is established in NetworkManager normally
  • Edit the Ethernet connection in NM and set IPv4 options to Shared to other computers.

    This will setup a private local network, start a DHCP server (dnsmasq), and enable routing from the local network to the 3G connection.

Wireless Router

  • Should be set to be a dumb Ethernet-WLAN bridge
  • Give it a static IP and connect the Ethernet cable from the desktop to its LAN port, if it has one. If it only has a WAN port enable DHCP on that instead of PPP, PPPoE or whatever.

Laptop

  • Just connect to the wireless network. You should receive an IP from the desktop by vitue of Shared with other computers being enabled.

That’s it.

share|improve this answer
    
Yes there's an ethernet connection from the desktop to the wireless router. This looks very promising. Lemme try this out. –  Sudhanshu Aug 7 '10 at 13:37
    
Looks like my WRT45G cannot be easily converted into a WLAN bridge, without a firmware upgrade. –  Sudhanshu Aug 7 '10 at 16:39
    
Are you running the stock Linksys firmware? I strongly recommend OpenWrt if it supports your router (it should, depending on the hardware version). –  Li Lo Aug 7 '10 at 19:46
    
The second point under Wireless Router is all that’s required to make it a bridge. The WLAN and LAN are already bridged together. Just plug the Ethernet cable into one of the four LAN ports. –  towolf Aug 15 '10 at 22:06
  1. Right click the Network Manager applet and click "Edit Connections"
  2. Go to "Wireless" tab and click "Add"
  3. Enter "ICS" in the "Connection name" field
  4. Enter "ICS" in the SSID field
  5. Change the Mode to "AdHoc"
  6. Go to "IPv4 Settings" and select Method "Shared to other computers"
  7. Connect to the ICS wireless network

These steps are from memory and might be incomplete. WPA2 security seems not to work.

See http://www.ubuntugeek.com/creating-an-adhoc-host-with-ubuntu.html also.

share|improve this answer
    
Unfortunately, that does not solve my problem. Or at least I don't see yet how it does! My desktop does not have a wireless networking card. I can reverse the setup probably by shifting the connection to my Linux laptop, but that laptop goes around with me - so when I'm not at home, others still cannot share the internet connection at home. –  Sudhanshu Aug 7 '10 at 6:10
    
See if towolf's answer helps. It's based on a different setup than I understood. –  Li Lo Aug 7 '10 at 13:08
    
+1 for your comment in point 6 - gave me a hint about how to go about this. –  Sudhanshu Aug 7 '10 at 18:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.