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.

After upgrade to 13.10 my DNS resolving fails. It seems the DNS servers which I get by DHCP (LAN) are not used.

I could temporary solve the problem by adding nameserver 8.8.8.8 to /etc/resolv.conf. But then the intranet hosts still can not be resolved.

When clicking on the Connection Information menu item on the network indicator, the Primary DNS and the Secondary DNS are set correctly. But my computer seams not to use them.

So my questions:

  • What should I put into resolv.conf, if anything?
  • How to find out, which name servers my computer is querying?
  • Where to look next, to find out, why name servers received by DHCP are not used?
share|improve this question

3 Answers 3

up vote 13 down vote accepted

First you need to know a bit about how name resolving works in Ubuntu since Ubuntu 12.04.

Stéphane Graber blogged some information about it last year (https://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/). The most important thing to know is that both Ubuntu Server and Ubuntu Desktop use resolvconf to manage the resolv.conf file. That means that you should no longer edit /etc/resolv.conf directly; instead you should configure your network interface configuration utility to provide the right information to resolvconf. For Ubuntu Server the network interface configuration utility is ifup and it is configured by the file /etc/network/interfaces. For Ubuntu Desktop the network interface configuration utility is NetworkManager. This is what you are using.

NetworkManager is configured by means of network indicator | Edit Connections.... However, for network interfaces configured by DHCP it normally isn't necessary to change any settings manually. Normally what happens is that the (remote) DHCP server provides to NetworkManager both an IP address for the local interface and the address of a (remote) DNS nameserver to use. NetworkManager starts an instance of a forwarding nameserver that listens locally at 127.0.1.1. This address, 127.0.1.1, is sent to resolvconf which puts nameserver 127.0.1.1 in /etc/resolv.conf. NetworkManager also gives the (remote) IP address of the DHCP-provided DNS nameserver to the forwarding nameserver. Thus a program running on the local system asks the resolver to translate a host name into an IP address; the resolver queries the local forwarding nameserver at 127.0.1.1; the forwarding nameserver queries the remote nameserver(s) it has been told about, receives an answer and sends it back up the chain.

NetworkManager communicates with the forwarding nameserver process over D-Bus. You can see what NetworkManager told the forwarding nameserver by running the command nmcli dev list iface eth0 | grep IP4.DNS.

Update arising from the comments: Note that resolvconf actually writes the file /run/resolvconf/resolv.conf to which /etc/resolv.conf is supposed to be a symbolic link. If /etc/resolv.conf is not a symbolic link then you need to recreate it. To do so you can run sudo dpkg-reconfigure resolvconf or sudo ln -sf ../run/resolvconf/resolv.conf /etc/resolv.conf.

share|improve this answer
    
Thank you very much for this info. In my case the command shows the correct DNS servers. But the resolf.conf file is not updated. It has the timestamp from when I have put my values there. So I will have to find out why resolvconf is not writing the file. –  Witek Oct 31 '13 at 10:55
4  
Resolvconf actually writes the file /run/resolvconf/resolv.conf and /etc/resolv.conf is supposed to be a symbolic link to /run/resolvconf/resolv.conf. If you deleted /etc/resolv.conf then you deleted the symbolic link. To recreate the symbolic link you can run sudo dpkg-reconfigure resolvconf or you can do mv /etc/resolv.conf /run/resolvconf/resolv.conf && ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf –  jdthood Oct 31 '13 at 15:02
    
Great answer! Thank you jdthood. –  zzeroo Dec 18 '13 at 6:04
    
This has everything but the 'fix'. How can I resolve this issue? –  Amal Murali Jan 18 at 22:19
    
The fix may be to run sudo dpkg-reconfigure resolvconf as suggested in the last part of the answer. –  jdthood Jan 20 at 13:09

I made the change suggested on the link below (disabling dnsmasq). Now everything works great! http://www.ubuntugeek.com/how-to-disable-dnsmasq-in-ubuntu-12-04precise.html

Open /etc/NetworkManager/NetworkManager.conf file.

sudo gedit /etc/NetworkManager/NetworkManager.conf

Comment out following line

dns=dnsmasq

/ Richard

share|improve this answer

It's actually really easy.

just open your interfaces conf file --> sudo vi /etc/network/interfaces

and under your interface (probably eth0) you will see all the usual config.

address 192.168.22.71
netmask 255.255.255.0
gateway 192.168.22.1

After gateway just add 'dns-nameservers 8.8.8.8 8.8.8.9' or whatever nameserver you're going to use.

So your config should be:

address 192.168.22.71
netmask 255.255.255.0
gateway 192.168.22.1
dns-nameservers 8.8.8.8 8.8.8.9

then just do a 'sudo service networking restart' and you're good to go!

share|improve this answer

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.