Ubuntu – How to connect to the internet

12.04internet connection

The IT guy at my mom's office had an old computer that he could give me to make a server out of. I took it and installed Ubuntu Server 12.04.1 LTS on it. However, I have no connection to the internet and I can't figure out how to connect. The preferred end result would be a wireless connection, but for now I'd be happy with any connection, wireless or otherwise.

I ran sudo apt-get update and that returned a whole list of W: Failed to fetch [some arbitrary website]

I read up on a few articles and took this error to mean that I am not connected to the internet. How do I connect?

NOTE: Although I have been using servers/computers/etc. for a while, I am extremely new to Ubuntu. (I have only been using it for 1 day.)

If anyone knows how to fix this or even has a pointer in the right direction, I would be very grateful.



Best Answer

If you are running a server, I assume you are running without a graphical interface or desktop. If so, you are not running Network Manager. First, let's determine if you have a working ethernet interface. Please run:


Do you see an ethernet interface eth0? If so, hook up an ethernet cable and do:

sudo dhclient eth0

Did you connect; that is, get an IP address from the router or other access point? If so, now we can install some updates and needed software:

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install vim

Now, let's amend a file for a proper static IP address useful for a server:

sudo vim /etc/network/interfaces

Right now, it probably looks like:

auto lo
iface lo inet loopback

Press Insert to add text and let's set up a static IP address for your ethernet interface:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

Press Esc to exit the Insert mode. Proofread carefully. Press :wq. Of course, the details need to fit your system and the address should be outside the range used by the DHCP server in the router. Now let's get the system to read the new changes:

sudo ifdown eth0 && sudo ifup eth0

Check if the new address is working:


It ought to now show the new IP address; in my example, Now see if you can reach the internet:

 ping -c3 www.google.com

Once all this is in order, I suggest you start a new question specifically about wireless.