What's the point of dnsmasq in NetworkManager?

I very recently came to realize that the caching is disabled by default on the dnsmasq that is integrated with NetworkManager. In my mind, that defeats the point and makes dnsmasq a redundant layer in name resolution.

Obviously, I must be missing something - what is the purpose of dnsmasq in NM?


The point is that switching nameservers is annoying. /etc/resolv.conf only gets read once when you start an application (technically when you do the first lookup), so if you change nameservers (because you moved from wireless to wired to 3g and back etc.), you will need to restart applications that need to look up names (such as browsers).

This is mitigated by using the local resolver, which does respond to these changes in a timely fashion, allowing applications to remain stupid and only query the nameserver on localhost.


From man NetworkManager.conf on 16.04, on the dns option:

dnsmasq: NetworkManager will run dnsmasq as a local caching nameserver, using a "split DNS" configuration if you are connected to a VPN, and then update resolv.conf to point to the local nameserver.

So basically if you connect to a VPN, NetworkManager can instruct dnsmasq to use any VPN-specific DNS servers for required domains. This is impossible to do with just resolv.conf.