1

The problem

My Custom DNS-Server is randomly not queried anymore.

The Setup

I am using Ubuntu 18.04 and I have my own DNS server in my network. I set up my dhcp server to set up that DNS server for the network. Before I had set up my DNS server explicitly, but now I am visiting two wifi access points and the second one doesn't have that DNS server.
Now I have deleted the nameservers section from my netplan yaml file, because I can't seem to set it on a per AP basis.
After a reconnect everything works fine for a while, but then suddenly the DNS server doesn't answer anymore for anything in my lan, but public stuff like google works fine.
When I reconnect then, it works again for a while, and then seemingly randomly stops.

Running dig with the dns server explicitly works fine. I am confused, dig says the response comes from the systemd-resolved resolver on 127.0.0.53. However the output of systemd-resolved --status reports the correct dns server settings for my interface.

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 4 (tun0)
<OpenVPN not in use>

Link 3 (wlp1s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.1.5
                      <ipv6>
          DNS Domain: ~.
                      lan

Link 2 (enp2s0)
<not in use>

Setting the DNS IP for the interface in netplan via

nameservers:
  addressess: [my.local.dns.server]
  search: [lan]

works fine, but again I can't do that anymore because i visit multiple access points and a configuration per access point seems impossible at the moment.
Setting the DNS server in network manager on it's own connection works fine, also.

I find this rather frustrating and want to know what DNS server I am using and why my own one isn't used anymore at random, and also why it comes back at random. I disabled DHCP on my fritzbox, it acts as a DNS server, but shouldn't be used (my own dns server uses it after 1.1.1.1 and 8.8.8.8).

My configuration:

/etc/resolv.conf:

# [comment block about this being systemd-dnsresolv stub]
nameserver 127.0.0.53
options edns0
search lan

/etc/nsswitch.conf

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns myhostname
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

/etc/hosts

127.0.0.1 localhost
127.0.1.1 <myhostname>.lan <myhostname>

::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Edit

I had a look with wireshark when I ran dig. DNS queries were sent out to an ipv6 address, not my local dns server. The IPv6 Address was that of my router. Why is that?

Edit2

My current netplan config:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp2s0:
      dhcp4: yes
      dhcp6: yes
  wifis:
    wlp1s0:
      dhcp4: yes
      dhcp6: yes
      dhcp-identifier: mac
      access-points:
        "SSID1":
          password: ****
        "SSID2":
          password: ****

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.