ubuntu 16.10 dnsmasq troubleshoot
5 March, 2021 by
ubuntu 16.10 dnsmasq troubleshoot
Administrator
| No comments yet


Ok, so here’s what I’ve learned. Ubuntu uses systemd-resolved now for DNS stuff. However, if you want the DNS server from DHCP negotiation to be passed along to this service, you also need to use systemd-networkd to configure your interfaces. This means no NetworkManager, no resolvconf, no dnsmasq. Link Link Link

Ok, so let’s switch to systemd-networkd:

sudo systemctl enable systemd-networkd
sudo systemctl disable NetworkManager
sudo systemctl stop NetworkManager
sudo systemctl start systemd-networkd

I also need to create /etc/systemd/network/wired.network so that systemd-networkd knows what to do:

[Match]
Name=eth*
[Network]
DHCP=yes

Finally, we need to set up this softlink so that systemd-resolved controls which DNS servers are used:

sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Ok, so. For whatever reason, systemd-resolved doesn’t properly resolve unqualified domains. I thought it might be because it was trying to do DNSSEC verification (which my router’s DNS server doesn’t support), but even when I allowed fallback, it still didn’t work. No idea what’s going on, but I have to assume it’s a bug in systemd-resolved.

Having said that, I can still use systemd-networkd and systemd-resolved to control /etc/resolv.conf (i.e. have it point to my router’s DNS server). I just want things to skip trying to use systemd-resolved, so that means removing resolve from /etc/nsswitch.conf, so everything always falls back to DNS, which properly resolves my unqualified domains names:

Before:

hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns

After:

hosts: files mdns4_minimal [NOTFOUND=return] dns

When nsswitch falls back to DNS, it properly resolves bruce. to its IP on my router’s subnet, not 127.0.0.1, so that’s good enough to fix this problem.

Another alternative might be to have my router’s DNS server put all the names in a LAN domain, and configure systemd-resolved to try to append that domain…but I’m fed up.

Sign in to leave a comment