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.

I am having DNS problems since upgrading to Ubuntu 12.04 (Precise Pangolin) from Ubuntu 10.04 (Lucid Lynx) yesterday.

DNS sometimes works, but it is very slow.

I have read the blog post DNS in Ubuntu 12.04.

  • "I really don’t want a local resolver, how can I turn it off? To turn off dnsmasq in Network Manager, you need to edit /etc/NetworkManager/NetworkManager.conf and comment the “dns=dnsmasq” line (put a # in front of it) then do a “sudo restart network-manager”."

I do not have this line to comment. Checking in Synaptic Package Manager reveals that dnsmasq isn't installed (dnsmasq-base is).

Editing and creating connections using the NetworkManager GUI (and specifying DNS servers) doesn't help; Ubuntu is not respecting user GUI set DNS servers. Should these GUI tools not work?

  • "I use a static IP address configuration, where should I put my DNS configuration? The DNS configuration for a static interface should go as “dns-nameservers”, “dns->search” and “dns-domain” entries added to the interface in /etc/network/interfaces"

Are any examples of this available? My /etc/network/interfaces is extremely sparse.

For now, I have edited /etc/resolv.conf replacing nameserver 127.0.0.1 with that of my DNS server (my broadband router), but I don't know how long this fix will last before the file is overwritten by this new system (dnsmasq?).

share|improve this question

3 Answers 3

network-manager is meant to manage your whole workstation's networking requirements in 12.04 along with resolvconf and dnsmasq-base.

dnsmasq-base is just the executable dnsmasq file which network-manager runs using a separate config and no start-up scripts.

resolvconf rewrites /etc/resolv.conf whenever one of the 12.04 integrated packages tells it via scripts that something has changed.

It doesn't sound like it's correctly installed if you don't have that dns=dnsmasq line in your config. It might also account for the slowness.

You could try dpkg-reconfigure on network-manager and on resolvconf

Alternatively if you are using programs like VPNs that are not integrated with network-manager or other non-compatible programs, you could de-install network-manager and resolvconf completely and rely on isc-dhcp-client to set up your network and DNS, or pppd if you're using a modem.

dnsmasq under control of network-manager is intended to speed up DNS look-ups through caching, but if you de-install network-manager, then you'll also get rid of dnsmasq - at least it won't run on its own. You need the regular dnsmasq package to get it starting up and running at boot time.

You don't say if you need DHCP or you have static IP addresses.

share|improve this answer

Remove /etc/resolv.conf and make a symbolic link as follows:

/etc/resolv.conf -> /var/run/resolvconf/interface/NetworkManager

That is, execute:

ln -s /var/run/resolvconf/interface/NetworkManager /etc/resolv.conf

Local DNS in Ubuntu is always a bad idea (resolving domains after 10-15 requests).

share|improve this answer

Adam's answer provides correct background information.

If you have edited or removed /etc/resolv.conf then make sure that it is a symbolic link to "../run/resolvconf/resolv.conf" before continuing. If you have to restore this symlink then reboot before continuing.

If you have any DNS problems and you don't know what the reason is then it's a good idea to make sure that /etc/NetworkManager/NetworkManager.conf does not contain the line "dns=dnsmasq". Comment the line out. This rules out dnsmasq as a possible cause of the problem.

The question was "Why is my DNS slow?" If DNS works at all then the configuration must be essentially correct.

Long delays can be experienced if you have multiple nameservers listed in /etc/resolv.conf and the first listed nameserver does not respond. The glibc resolver(3) tries the first listed nameserver and waits five seconds before trying the next listed nameserver.

A second question was about the use of "dns-nameservers". Examples of the use of "dns-nameservers", etc., can be found in resolvconf(8). Run "man 8 resolvconf" in a terminal window to read this manual page.

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.