Xubuntu 18.04/20.04 Local DNS Resolution Stops Working

bartron on 1/1/2021

By default, Xubuntu 18.04 uses Multicast-DNS via Avahi for resolving local names.  This works great for normal use cases, but if you want to host a ".local" domain on a DNS server on your network, name resolution appears to stop working after about 30 minutes.  You can fix this with a couple of steps, assuming you have a DNS server up and running, and your DHCP settings are referencing it and attaching ".local" as a search domain.

First, you need to force your system to actually use DNS.  By default it's disabled.  Edit /etc/nsswitch.conf and make the hosts line something like this (with dns coming before the notfound part):

hosts: files dns [NOTFOUND=return]

Next, we need to make systemd use our standard network name resolving configuration.  Run:

sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Reboot your machine, and you should be good.

Tags