I'm trying to configure the nameservers in my Ubuntu 18.04 with netplan. I got a DNS server which is running on my localhost ( My configuration looks like this:

      addresses: []
      dhcp4: 'no'
      dhcp6: 'no'
        addresses: [,,,]
  version: 2

And when I'm doing an nslookup on some DNS name in my env it fails. The dig command is failing too with the NXDOMAIN error.

But, when I change the order of the addresses in the nameservers section to [,,,], after applying the configuration with netplan apply the nslookup query works and the dig outputs correctly with NOERROR.

My question is: why there is any significance to the order of the DNS servers? How can I force the netplan conf to look always in the regarding all\specific domain?

BTW all netplan apply are successful without any errors.


Figured it out- the DNS works with failover only if the DNS server is unreachable or there is a specific configuration in the DNS service to fallback to the next DNS server...

So yes- there is a significance to the order in the netplan nameservers configuration.

| improve this answer | |
  • 1
    However, systemd-resolved is also sticky when it fails over to a later DNS server in the list. So if you list first, and goes down, and resolved falls back to, it will continue using until restart or another DNS server failure. So you shouldn't use multiple DNS server addresses in an interface's nameserver section which don't all have the same view of names. Instead you probably want to use per-domain DNS servers as described in resolved.conf(5). – slangasek May 13 '19 at 2:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.