Set DNS server in Ubuntu 20.04 Focal Fossa

2020-05-01

Set contents of /etc/systemd/resolved.conf to:

[Resolve]
DNS=45.90.28.239 45.90.30.239
Domains=~.

Apparently spaces are separators. Those are NextDNS servers in the example btw. NextDNS has not sponsored this post.

Then run: $ sudo service systemd-resolved restart

This was one of about two hundred million things that took me too long to figure out while setting up Ubuntu 20.04.


And in case you want to resolve single-label lookups, systemd-resolved don’t do that.

  • apt install dnsmasq resolvconf
  • Set /etc/dnsmasq.conf config, eg values from my.nextdns.io
  • Disable systemd-resolved
  • Set dns=dnsmasq in /etc/NetworkManager/NetworkManager.conf
  • Set nameserver 127.0.0.1 in /etc/resolvconf/resolv.conf.d/base
  • Restart all teh things
← Three years of cold showers The joy of Elm →

No thoughts on “Set DNS server in Ubuntu 20.04 Focal Fossa”

Add your commentHow does this work?