I've recently upgraded to 17.10. When I try to browse to a website, or ping a domain it fails saying the site cannot be resolved.

network-admin shows the contents of /etc/resolv.conf to be nameserver:

If I change that to or then everything works. Until I reboot.

Upon reboot or resume, the nameserver is reset to

How do I permanently set the nameserver to something that works?

For systemd fans, if I run systemd-resolve --status I get

Link 3 (wlo1)
      Current Scopes: LLMNR/IPv4 LLMNR/IPv6
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

If I follow the advice at this question - DNS keeps resetting after reboot. Ubuntu 17.10 - DNS still fails to resolve.


You can install a package resolvconf, which will modify the way /etc/resolv.conf is built up at system boot.

sudo apt install resolvconf

You can then create or modify a file /etc/resolvconf/resolv.conf.d/tail. If you put in this file a line nameserver, this line will be added at the end of /run/resolvconf/resolv.conf at boot. /etc/resolv.conf will now be a symbolic link to this file.

  • 2
    This works - thank you! Do you know if there's any way to get to work by itself? – Terence Eden Mar 8 '18 at 12:27
  • I am fairly new to this matter. Just have been trying to get rid of dns problems when switching vpn on/off over the last weeks. You could try sudo dpkg-reconfigure resolvconf. I tried this lately, cleared the tail file, and at first this seems to work. – oscar1919 Mar 8 '18 at 13:31

I use Lubuntu & Kubuntu 18.04. I was able to overcome the DNS problem in 2 steps:

First step: Install unbound and set it to replace systemd-resolved as Grégoire C shows here.

sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
sudo systemctl enable unbound-resolvconf
sudo systemctl enable unbound


Open as root the file /etc/NetworkManager/NetworkManager.conf

(sudo leafpad /etc/NetworkManager/NetworkManager.conf in Lubuntu 18.04 or in Kubuntu 18.04 SUDO_EDITOR=kate sudoedit /etc/NetworkManager/NetworkManager.conf)

and below [main] put this line:


reboot again

Second step: If after the reboot the problem is still not solved, as it was in my case, start the file manager as root, go to /etc, delete resolv.conf and create a new resolv.conf. Leave it empty and reboot the OS. In my case after this reboot the problem disappeared.

In Kubuntu 18.04 you can't start Dolphin as root, so you can first go to /etc and open the terminal from there, then type sudo su and press Enter to use it as root and then delete resolv.conf with the command rm resolv.conf. Then you can create a new empty file on your desktop, name it resolv.conf and open a terminal from there. Use the sudo su command to enter the root mode for the terminal and then copy the new resolv.conf from your desktop to /etc with the command cp resolv.conf /etc.

I have to add that I did not try to do the second step before installing unbound, so the next time I will do so, just to see if it will be enough or not.

  • Why not just edit it as root and delete the contents? – Ballie Aug 8 '18 at 10:09
  • @Ballie I have tried this at first, but it did not help. Also the original resolv.conf from /etc was shown as some kind of a shortcut, which is not normal, I think. This is why I decided to delete it and recreate it by creating a new empty file and naming it resolv.conf. And it worked. By this reason I wrote above that the next time I have to reinstall the OS, I will try to do this first, without doing the "first step" - to see if it would be enough. But the original resolv.conf in /etc needs to be removed and recreated anyway - about this I am sure. – Калоян Грънчаров Aug 9 '18 at 20:35
  • I have just disabled systemd-resolved.service and removed the link of resolv.conf and created one manually, and it worked! – André M. Faria Jan 30 at 19:32

working within the systemd paradigm add a DNS to a link / device

using ubuntu 17.10+ add a *.network file:

sudo nano /lib/systemd/network/100-somecustom.network:

100-somecustom.network ( 100 can be any number for priority, and it requires the .network file extension ):

Name=wlo1 # the device name here

[Network] # add multiple DNS 

Then restart:

sudo service systemd-networkd restart

Also look into:

netplan apply

Then check:

systemd-resolve --status wlo1

From info page info systemd.network :

In addition to /etc/systemd/network, drop-in ".d" directories can be placed in /lib/systemd/network or /run/systemd/network directories. Drop-in files in /etc take precedence over those in /run which in turn take precedence over those in /lib. Drop-in files under any of these directories take precedence over the main netdev file wherever located. (Of course, since /run is temporary and /usr/lib is for vendors, it is unlikely drop-ins should be used in either of those places.)

Another approach disable the DNSStubListener for usage with dnsmasq:

sudo nano /etc/systemd/resolved.conf:



  • Strange is that you stated that the DNSStubListener=false, but the actual commented configuration is DNSStubListener=yes, usually the inverse of the "yes" value is "no" and not "false" who in case of "false" was usually be "true". – André M. Faria Jan 30 at 19:16
  • Your answer to create a file with extension .network didnt worked. – André M. Faria Jan 30 at 19:19

Why won't you just fix resolved and avoid trying to cure migraine with a guillotine?

Just put or whatever you need in DNS= configuration of /etc/systemd/resolved.conf, then restart systemd-resolved.service.

  • At least for me this answer doesnt work, using ubuntu 18.04, after change the "DNS" entry it keep usint the – André M. Faria Jan 30 at 19:03
  • 1
    @AndréM.Faria learn how resolved works. is the address of the local caching stub resolver. It forwards DNS requests to whatever upstream DNS servers you specify. – intelfx Jan 31 at 2:53
  • Sometimes you know something and just ignore it, yes you right. – André M. Faria Jan 31 at 11:46
  • Also good to note here, is that by default systemd-resolved caches DNS responses. While this may be useful sometimes, it can cause problems in some situations. Uncomment the cache=yes line in the config file in the answer and set it to no. – Quentin Skousen Feb 13 at 17:32

When using dhcp name resolution works as expected in Ubuntu. The problems begin when you want to go static. cat /etc/resolv.conf will show that yor dns is and not the ones you have in /etc/netplan/.yaml file. To fix this you need to remove the /etc/resolve.conf link and create a new one pointing to /run/resolve/resolve.conf

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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