Linux dns resolved to dnsmasq

From Phormix Wiki
Jump to: navigation, search

Switching from ResolveD to DNSMasq

ResolveD is a solution in search of a problem. Like much of systemd, purports to be more efficient and convenient for users than the alternatives. Also like much of systemd, it breaks things and new and unexpected ways.

One of these ways is that it tends to ignore local authorative DNS hosts, and local DNS suffixes (such as, .local).

As such, it may be preferable to switch to a more stable DNS resolved such as DNSMasq

Install dnsmasq


Configure NetworkManager to use dnsmasq instead of resolved

  • Update /etc/NetworkManager/NetworkManager.conf
  • Find the "main" section
  • Add or edit the following entry
dns=dnsmasq

Next, restart NetworkManager (noting that this may interrupt active connections)

systemctl restart NetworkManager

And point your resolve.conf at the one generated by NM

ln -nfs /var/run/NetworkManager/resolv.conf /etc/resolv.conf

 


Disable resolved

Now it's time to put resolved to bed. You can uninstall it completely, or just ensure it won't start

systemctl stop systemd-resolved
systemctl disable systemd-resolved

and if you really want to kill it

systemctl mask systemd-resolved

Update nsswitch.conf

Update the "hosts" line in /etc/nsswitch.conf, remove the portion like

mdns4_minimal [NOTFOUND=return]