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.

  • 4
    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
  • 1
    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
  • @TerenceEden if you are looking to make to work by itself (as it should), take a look at my answer: askubuntu.com/a/1083843/281191 – intelfx Mar 5 at 14:57

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

The correct solution would be to fix systemd-resolved instead of trying to cure migraine with a guillotine.

It is a nice tool, really, if used properly.

Judging by your systemd-resolve --status output...

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

...your network manager tool does not pass per-interface DNS configuration to systemd-resolved.

Recent versions of NetworkManager, for example, would do this automatically if /etc/resolv.conf is a symlink pointing inside /run/systemd/resolve or to /usr/lib/systemd/resolv.conf. Alternatively, recent versions of systemd-resolved try to be compatible with the historical resolvconf interface by installing a resolvconf binary that talks to systemd-resolved.

While using either of these two solutions would be preferred, if you are looking for a quick and dirty solution, you can just configure systemd-resolved to use your DNS servers globally:

$ cat /etc/systemd/resolved.conf

Then restart systemd-resolved.service or reboot.

  • 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
  • 1
    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
  • what actually causes /etc/resolve.conf (or really, /run/resolvconf/resolv.conf, which the former points to) to be updated? would be nice to know for testing, without a presumed reboot being required. all i can say is that restarting systemd-resolved.service did not seem to do the trick – bbarker Mar 4 at 19:22

This is how I change my dns record on the interface configuration.

$ vi /etc/netplan/50-cloud-init.yaml

Change name server addresses, previously it was .4 then I changed it to .3:


Save the configuration and then apply the configuration:

$ sudo netplan apply

After that restart the resolvectl service.

$ sudo systemctl restart systemd-resolved.service

For notes: I did reboot the server and changes that I made still intact. I use resolvctl dns command to verify the dns record.

  • This is actually the correct answer. I'm surprised it's not the accepted one. – Toumal Apr 9 at 15:17

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


This required some playing around with. After I updated the setting, I rebooted. Use:

ln -s /run/resolvconf/resolv.conf /etc/resolv.conf


System resolved failed
systemctl stop systemd-resolved
systemctl disable systemd-resolved

When Comment out the "request" for

# domain-name, domain-name-servers, domain-search, host-name,

Add this line to your /etc/dhcp/dhclient.conf:

 supersede domain-name "cwillenterprise.com";

Edit config file and add entry. Additional will not replace.

Add entries to /etc/resolvconf/resolv.conf.d/tail

search "cwillenterprise.com"

Run to implement changes

resolvconf -u
  • 1
    Welcome to Ask Ubuntu! Please edit your answer to use code formatting for the code that should be entered in files or terminal. Do not prepend # to “comments” to the code – it means header in Markdown. Please always check the preview of your post before sending it. – Melebius Mar 5 at 9:10

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.