Ubuntu – Ubuntu 19.04 bind not resolving locally

binddnsnetplannetworkingserver

Just trying the newest Ubuntu 19.04 and it has some differences with resolv.conf when running my own bind locally.
Previously in 18.04 resolv.conf looks like this

nameserver 127.0.0.1
nameserver 127.0.0.53

while in 19.04 it has changed to this

nameserver 127.0.0.53
options edns0

If I use dig or nslookup to check for a DNS lookup it does not use the local bind configuration and gets a not found.

If I put

dig www.example.com @127.0.0.1

vs the default dig www.example.com

dig www.example.com @127.0.0.53 

it is working and gets a proper response to the lookup.

I tried adding a netplan yaml file
/etc/netplan/00-private-nameservers.yaml

network:
    version: 2
    ethernets:
        enp0s3:
            nameservers:
                addresses:
                - 127.0.0.1
                - 1.1.1.1
                - 1.0.0.1
                - 8.8.8.8
                - 4.4.4.4
                #search: [ nyc3.example.com ]

but it does not change resolv.conf to do the local lookup as it should I think.

This version is new to me and I am unsure if this is a bug or what?
Again I am running bind locally and expect it to resolve domains lookups locally.

[I have added this in regards to the comment below.]

root@server:/tmp# systemd-resolve --status
Global
       LLMNR setting: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
          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 2 (enp0s3)
      Current Scopes: DNS
DefaultRoute setting: yes
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 127.0.0.1
                      1.1.1.1
                      1.0.0.1
                      8.8.8.8
                      4.4.4.4
                      192.168.2.1
                      2001:569:7552:3900:4a5f:38ee:fe29:130

Without the private nameservers yaml it shows

Link 2 (enp0s3)
      Current Scopes: DNS
DefaultRoute setting: yes
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.2.1
                      2001:569:7552:3900:4a5f:38ee:fe29:130

Best Answer

You can edit /etc/systemd/resolved.conf

and set the DNS to the locally running bind aka DNS Server via

[Resolve]
DNS=127.0.0.1

restart with

systemctl restart systemd-resolved.service

and when you dig (or lookup as explained above) you DO get (just) a www.example.com A record with a locally served DNS' zone files appropriate IP result but it doesn't display as much information as what you get if you append @127.0.0.1 or the resolv.conf has 127.0.0.1 ahead of 127.0.0.53

This is a partial answer sourced from the help in comments and should be retained and not deleted like all the other replies I added that were delete on the grounds they where not declared like this one as a valid/useful Answer or partial answers, but they probably where useful for certain situation. In my case I'm doing DNSSEC etc. and need to see more substantial results like those from @127.0.0.1 or at least that was why I didn't put more clarity on it being correct in some cases. I was of course expecting the full response you get when the resolv.conf points directly to the DNS running on the system at 127.0.0.1 and not chained via 127.0.0.53 to the DHCP provided router gateway (typically).

[Also please note the meager comments are insufficient to show work with code blocks and results, hence the importance of not deleting the communities discussion on resolving these problems together. Please consider multiple user flags for deletion status.]

Related Question