Ubuntu – 18.04 ignoring DHCP-provided DNS server

18.04dnsnetworking

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?

Best Answer

I succeeded as follows:

mv resolv.conf resolv.conf-old
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
Related Question