Comment 27 for bug 324233

Revision history for this message
Paul Smith (psmith-gnu) wrote :

I don't think it's correct for NetworkManager to write directly to the file managed by resolvconf. The entire point of resolvconf is that IT'S supposed to manage the resolv.conf file. Resolvconf is very useful if you (like I do!) have one or more VPN solutions (sometimes I have to connect to two or even three at the same time!) Each of these VPN solutions has its own set of DNS servers that we want to use to use to resolve hostnames in that subdomain (local hosts that are not visible in public DNS servers).

Resolvconf manages this by maintaining a separate resolv.conf file for each INTERFACE then merging them together.

If you use this in conjunction with, for example, dnsmasq as a local DNS caching proxy server, then your /etc/resolv.conf should ALWAYS use "nameserver 127.0.0.1", and dnsmasq has some scripts it installs to configure resolvconf to configure dnsmasq to find the "real" upstream DNS servers. This works pretty well... IF AND ONLY IF you let resolvconf manage the contents of resolv.conf.

So, they way it's supposed to work is that when you want to modify resolv.conf based on bringing up a new interface, and resolvconf is available, instead of doing something like:

    echo "$RESOLVCONF" > /etc/resolv.conf

you do something like:

    echo "$RESOLVCONF" | resolvconf -a <interface>

where <interface> is the name of the new interface brought up, like tun0 or whatever. Similarly, when the interface goes down rather than rewriting /etc/resolv.conf with some kind of saved backup, all you have to do is run:

    resolvconf -d <interface>

to undo the changes made for that interface.

Personally I think it's a fundamental mistake to have the manipulation of resolv.conf embedded in code inside NetworkManager. The reality is that, unlike Windows which handles this much better (!!), UNIX/Linux handling of DNS resolving is not very good and people need to customize it. NetworkManager should provide a script that does the resolv.conf manipulation, and invoke the script, rather than doing all internally in code. This allows customization for those who require it. This scripting can be done using the typical .d directory method, etc. so that more advanced behaviors can be installed without modifying NetworkManager files directly.