General
Ubuntu 12.04 connects to local network but not to the Internet
December 29, 2012
1

Tux Last week I upgraded my distro from 11.10 to 12.04 without any problem. After the first update  I went to work and I couldn’t reach any website, the only thing I could do was connecting to my office LAN. What happened is that Ubuntu team changed the way of DNS resolving; practically before 12.04 you could add any DNS entry (unless you don’t use a complete automatic DHCP management, I use DHCP for machine IP address and manually configured DNS) in a file called resolv.conf placed in /etc folder. With 12.04 this has been changed and /etc/resolv.conf is not a static file anymore but it’s dynamically managed by NetworkManager or any other else application that needs to change it. If you want more infos about it click here.

To solve the problem there are two ways:

  1. Insert your preferred DNS addresses in resolv.conf and make the file static again ( I don’t like this way to proceed)
  2. Add DNS addresses in the interfaces file for each network interface (this is the preferred way)

So, just open a terminal window and digit

sudo nano /etc/network/interfaces

This will open the interfaces file that will look almost like this

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet manual

auto eth0
iface eth0 inet manual

Now what you need to do is adding your dns to each interface; in this example I will add google’s DNS to eth0 and wlan0 using the reserved word dns-nameservers. The file will now look like:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet manual
dns-nameservers 8.8.8.8 8.8.4.4

auto eth0
iface eth0 inet manual
dns-nameservers 8.8.8.8 8.8.4.4

Now every time you reboot your computer, the resolv.conf file will be overwritten, while the DNS configuration used will be the one in  /etc/network/interfaces file.

Enjoy!!

Leave a Reply

1 comment

  1. […] See the article here: Ubuntu 12.04 connects to local network but not to the Internet … […]

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close