Why did I have to remove resolvconf to get dnsmasq to work again?

33,424

Solution 1

The simple answer to (1) is: resolvconf sets itself up as the intermediary between programs that supply this information (such as ifup and ifdown, DHCP clients, the PPP daemon and local name servers) and programs that use this information (such as DNS caches and resolver libraries). As of Ubuntu 12.04 resolvconf is part of the default installation in both the server and desktop variants. It is never necessary to remove resolvconf and people who do remove it usually don't understand it, generally because they haven't read resolvconf(8) and /usr/share/doc/resolvconf/README.gz.

The answer to the second question is that resolvconf most probably did not interfere with dnsmasq. My guess is that you were running into bug #959037.

Explanation: In Ubuntu 12.04 there are two ways in which dnsmasq gets run. There is the traditional standalone version of dnsmasq which listens on all addresses. And there is the new NetworkManager-controlled dnsmasq process which listens only on 127.0.0.1. The latter conflicts with the former unless the former is reconfigured. This problem was solved in Ubuntu 12.10 by having the NM-controlled dnsmasq process listen on 127.0.1.1 instead of 127.0.0.1 and by forcing the standalone dnsmasq process to listen only on addresses assigned to interfaces.

Solution 2

I've just removed it on my install. I was using pppd manually to dial my 3G modem connection and resolvconf interfered with my dns settings by automatically adding my provider DNS when I wanted to use custom DNS. pppd has options to control this but resolvconf clobbered them with its own settings. I would also like to know answer to this question? It seems like this is some make-it-easier-but-instead-complicate-things kind of package?

p.s. I've found this bug report: https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/922578

Solution 3

The simple answer to (1) is: resolvconf sets itself up as the intermediary between programs that supply this information (such as ifup and ifdown, DHCP clients, the PPP daemon and local name servers) and programs that use this information (such as DNS caches and resolver libraries).

That's from the package description. On desktops, it works in conjunction with NetworkManager to handle making and dropping connections smoothly.

So resolvconf, along with dnsmasq, are used in 12.04 to make the DNS info handling more reliable on the desktop version. So in some situations, it does make things better, but the whole situation lacks the documentation in the right place, esp. in the server world.

Despite loads of Googling, I haven't been able to ascertain what is recommended on a server installation.

As far as (2) goes, you're having the opposite problem from me. Dnsmasq works well with resolvconf on my machine and updates the /etc/resolv.conf file to contain 127.0.0.1 but has other problems because dnsmasq doesn't get the ISP name servers from dhclient on eth0 (this is a gateway) nor does it get the name servers I manually entered in the eth0 stanza in /etc/network/interfaces.

Why do you use dnsmasq? Are you also running a gateway with 2 nics? Or is it just a plain desktop? If so, resolvconf co-ordinates with network-manager

Share:
33,424

Related videos on Youtube

lightxx
Author by

lightxx

Updated on September 18, 2022

Comments

  • lightxx
    lightxx over 1 year

    Yesterday I upgraded to Precise and dnsmasq stopped working. That is, DNS queries to localhost where dnsmasq is listening (127.0.0.1) were refused.

    Removing resolvconf (apt-get remove resolvconf) and rebooting solved the issue (found that suggestion somewhere on Google). /etc/resolv.conf looked fine with and without resolvconf in place. No difference at all.

    1. Why would I use resolvconf? Are there any benefits? The Wikipedia article covering resolvconf sucks.
    2. Why did resolvconf interfere with dnsmasq? Is this a known issue?
    • lightxx
      lightxx over 11 years
      bla@blubb:~$ [ -f /usr/share/doc/resolvconf/README.gz ] && echo "Found" || echo "Not found" Not Found um. smartass.
  • lightxx
    lightxx almost 12 years
    thanks for your input. i'd have upvoted it but i'm lacking the rep.
  • Pawel K
    Pawel K almost 12 years
    @lightxx: Upvoted for you ;)
  • lightxx
    lightxx over 11 years
    thanks for your answer. i would have upvoted it, unfortunately you need 15 reputation to upvote. lol
  • jdthood
    jdthood over 11 years
    Instead of removing resolvconf you could have configured resolvconf to ignore nameserver information coming from pppd.
  • Michael Mior
    Michael Mior almost 11 years
    I've read the manapage and still can't find a reliable way to prepend my own nameservers to resolv.conf.
  • jdthood
    jdthood almost 11 years
    With resolvconf installed you can prepend a nameserver address by putting nameserver x.x.x.x in /etc/resolvconf/resolv.conf.d/head. Be advised, however, that this is generally not necessary or recommended. Generally there is a more correct way to add "nameserver" lines to resolv.conf. Generally the utility that configures a network interface adds or removes the nameserver addresses available via that interface by running resolvconf -a or resolvconf -d, respectively. Prioritization of nameserver addresses added in this way is governed by /etc/resolvconf/interface-order.
  • Michael Mior
    Michael Mior almost 11 years
    Actually, putting a nameserver line in head added it AFTER the default nameserver.
  • Michael Mior
    Michael Mior almost 11 years
    I haven't tested it, but it seems like echo x.x.x.x | resolvconf -a lo would do the trick for adding a nameserver which I'd like to be first for all interfaces.
  • jdthood
    jdthood almost 11 years
    Resolvconf always puts the contents of head at the head (top, beginning) of resolv.conf.
  • Michael Mior
    Michael Mior almost 11 years
    Apparently not in my case. As mentioned, it was added at the bottom.
  • jdthood
    jdthood almost 11 years
    If the contents of head were not added at the top then either (1) it wasn't resolvconf that wrote the file or (2) there is a non-standard version of resolvconf on your machine. 1: There are third party programs, especially VPN clients, that overwrite /etc/resolv.conf directly and do things like insert lines at the top of the file. 2a: It is possible to change the behavior of resolvconf by editing files under /etc/resolvconf/. 2b: Some people actually have the openresolv package installed. Openresolv is an alternative to resolvconf which is at least partially resolvconf-compatible.
  • Adam
    Adam almost 11 years
    man pages are great when you know what you need to know. If you don't, they can be puzzling to say the least. Howto's, examples and faqs are what you need when you don't have experience in an area.
  • fkl
    fkl over 9 years
    upvoted @lightxx on your behalf :)
  • ericx
    ericx over 7 years
    The normal contents of resolv.conf is quite simple. Whenever the machine is a server or even a non-laptop work station, it seems obviously easier to track the single resolv.conf instead of the half dozen different files potentially utilized by resolvconf .
  • a2f0
    a2f0 over 6 years
    @jdthood - i dont see how do do this in the resolvconf.conf man page, I'd be interested in implementation specifics.