18.04 ignoring DHCP-provided DNS server
I've got a local server (192.168.0.10) running dnsmasq to provide DHCP for my LAN, and a DNS server to resolve hostnames for the DHCP clients.
When I was running 16.04, this worked fine. Any machine getting a DHCP address from the server used the DNS server, and could resolve other hostnames on the network.
However, since upgrading to 18.04, I can't resolve hostnames any more. I understand that 18.04 now uses systemd-resolve. It appears that it's aware of the DNS server:
mark@coachz:~$ systemd-resolve --status
Global
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 3 (wlp59s0)
Current Scopes: DNS
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 192.168.0.10
Link 2 (enp58s0f1)
Current Scopes: none
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
However, it doesn't seem to use it to resolve hostnames:
mark@coachz:~$ nslookup homestar
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find homestar: SERVFAIL
Although if I explicitly tell it to, it can:
mark@coachz:~$ nslookup homestar 192.168.0.10
Server: 192.168.0.10
Address: 192.168.0.10#53
Name: homestar
Address: 192.168.0.101
How do I get it to use the DHCP-provided DNS server automatically?
I succeeded as follows:
cd /etc/
mv resolv.conf resolv.conf-old
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
It turns out the problem was that I didn't have a domain suffix configured in my dnsmasq server.
I added the line:
domain=lan
to /etc/dnsmasq.conf
and restarted the service, and I can now resolve the address for homestar
or homestar.lan
just fine.