How do I share my Ubuntu's Internet connection with a LAN (via hardware router)
Solution 1
Here's how I did it:
Equipment:
Ubuntu 11.04 Desktop on 1st Gen. eeePC
Linksys WRT120N Wireless N Router
Huawei E620 USB Broadband Modem
Ethernet cable
Hardware Setup:
Huawei plugged into eeePC
Ethernet cable plugged into Ethernet port
other end of Ethernet cable plugged into the
Internet
port of The Linksys
Ubuntu Setup:
- connect the Huawei to the Internet
- disconnect the wired connection (Auto Eth0) in network tray icon
- create new wired connection (Edit Connections... > Add, enter a name) and select
Shared To Other Computers
from IPv4 settings tab. - connect to this new wired connection
- note down the settings for this connection under
Connection Information
, and the DNS servers for the Huawei connection
Linksys Setup:
- connect a computer on the receiving side to the Linksys (wired or wireless)
- open a browser in this computer, navigate to Linksys (
192.168.1.1
is default, user and password should be both admin) - Change
Internet Connection Type
toStatic IP
- Under
Internet IP Address
I put the number that came after the eeePC's IP address for this connection (again, not the IP for the Huawei connection), this was just a guess as I'm pretty clueless about how this works. So, my Ubuntu machine had an IP of10.42.43.1
, and I gave the Linksys10.42.43.2
Subnet Mask
should be same as the eeePC,255.255.255.0
Default Gateway
should be the eeePC's IP address,10.42.43.1
in my case.DNS 1
(etc.) should be the same as thePrimary DNS
(etc.) used by the eeePC in the Huawei connection.- Click
Save Settings
.
And now all machines on my LAN can connect to the eeePC's Internet via the linksys router. All is well.
Solution 2
It's very easy. I use Norwegian, so the translations might not be correct, but I hope and believe you'll understand.
Click on the network icon and select "edit connections". Select wired connections in the first tab and select your network, usually something like "Auto eth0". Click the edit button on the right and in the new window, look at IP settings. There is a combobox there where you can choose "method" that includes DHCP, Static and Shared with other computers, among others. Choose "shared with other computers".
Now, simply connect your wired network connection on your PC to the uplink-port on your router (usually called WAN).
Finished. :)
Related videos on Youtube
yuttadhammo
Updated on September 18, 2022Comments
-
yuttadhammo over 1 year
I know this sort of question has been asked many times, and I've thus tried many ways to get it working, but I think my setup is a bit different from what I've seen others trying. I've got an Ubuntu box with a usb mobile broadband modem that connects me to the Internet, and I'm trying to share this Internet connection with an ordinary linksys router (WRT120N), and thereby with my wifi LAN. I've connected my Ubuntu box to the router via ethernet, but don't know how to get the router to use my Internet connection. Maybe this is more of a problem with the router configuration, but I tried creating a new wired connection in Ubuntu and selecting "Shared to Other Computers" under method, which seems useless.
Is there some easy way to make the router use the Internet connection used by the Ubuntu box for the LAN?
-
Admin almost 13 yearsAh, I think I figured it out... after creating the new wired connection, I needed to go into the router and change the Internet connection type to Static IP, and enter the information based on the new wired connection in Ubuntu. Now it seems to be working.
-
Admin almost 13 yearsyou should post this as answer if you think you resolve your question and accept the answer :)
-
Admin almost 13 yearsThanks, I wasn't sure if I could... think there's a rule against answering within 24 hours (maybe because I'm a newbie?)
-
Admin almost 13 yearsEight hours... I'll answer it in six more :)
-
Admin almost 13 yearsIn the meantime, here's my solution: ubuntuforums.org/showthread.php?p=10959765
-
-
yuttadhammo almost 13 yearsThanks, but that didn't work for me, until I configured a static IP for the router... maybe I'm mistaken, but without the static IP it didn't seem to work.
-
yuttadhammo almost 13 yearsYeah, it doesn't work for me... the router doesn't get an IP address unless I give it one. If you had some insight into WHY it doesn't work without a static IP, I'd be much obliged :)
-
MountainX over 8 yearsThis answer was helpful to me but it didn't have quite enough detail. In solving my own question I ended up creating a more detailed answer here: networking - How to use a 4G phone to provide WAN/Internet service to a LAN? - Ask Ubuntu askubuntu.com/questions/666972/…