I've tried using network-admin. It has a list of DNS servers, including and two that I put in. It always uses the 127 address first, no matter how many times I change it. The lists of files, hook scripts, etc, are confusing: where is the single configuration file for networking that I can modify to effect a permanent change?

I'm tired of asking my ISP's poor quality DNS server to serve my internet requests. I have no idea why Ubuntu repeatedly resets my configuration, or where the graphical interface stores this information -- until it's changed again. This is UNNECESSARILY confusing.

I checked network-admin gui an hour ago and it read, in order, I moved the two 8.'s to the top, above 127; just checked it, now the first, which wasn't on the list before, is -- which is my network routers lan-side address. Requests to this are routed to the internet; DNS requests here are automatically routed to att's DNS instead of Google's. This is demonstrated when there is a lookup error in FireFox browser it shows an error page from dnserrorassist.att.net

I really would like to have a single, static list of DNS servers, to be able to modify it at my will, and to set the lookup order in which they are used. Can i do that with Ubuntu (16.04)?

  • What "files" and "hook scripts" are you referring to? Are you manually editing the /etc/resolv.conf file and/or files in /etc/resolvconf/resolv.conf.d/ (base/head/tail)? or are you talking about configuring via the network manager GUI? Sep 4, 2016 at 1:18
  • 1
    1. "Traditionally, the file /etc/resolv.conf was a static configuration file that rarely needed to be changed or automatically changed via DCHP client hooks. Nowadays, a computer can switch from one network to Sep 4, 2016 at 1:36
  • 1
    another quite often and the resolvconf framework is now being used to track these changes and update the resolver's configuration automatically. It acts as an intermediary between programs that supply nameserver information and applications that need nameserver information. Resolvconf gets populated with information by a set of hook scripts related to network interface configuration. Sep 4, 2016 at 1:36
  • 1
    Really I'm just trying to set a couple of google nameservers to be at the top of the list; I keep getting errors from dnserrorassist.att.net because they aren't current or the server is busy or whatever. No matter how many times I set or any other servers at the top of the list using the gui, next time I boot it's back to using the default, That seems like a problem with Ubuntu's name resolution system setup. If it's not, if there is a reliable way to set it, I'd like to find it, set it, move on to user-ville Sep 4, 2016 at 1:50
  • 1
    Thanks for that, and I see your point, but is it then beyond the scope to ask why my webpage loads make requests that are then resolved by att.net DNS servers instead of Google DNS servers as specified in the gui network-admin? Sep 4, 2016 at 2:28

3 Answers 3


This is an old post at this point, but I had some additional information. If you are running a headless server then the following should come in helpful.

For DHCP Configurations: Modify /etc/network/interfaces. Under your interface (eth0, etc) add the following line:

dns-nameservers # replace with wanted IP

This only APPENDS a DNS server if your DHCP server is already configured to provide you one!!! To OVERRIDE the DHCP server's provided nameserver modify the following file.

supersede domain-name-servers # replace with wanted DNS server

You will then need to restart your network. Something like the following should do. # invoke-rc.d networking restart

Now if you view /etc/resolv.conf you should see only your nameserver(s).

  • 2
    I followed your instructions and it worked great. I worked on headless Ubuntu 16.04.2 installation.
    – Sergei G
    Jun 5, 2017 at 20:12
  • 1
    resolv.conf is far from the most suitable way to select a DNS server. See the accepted answer for a better alternative (at least for most users). Sep 10, 2018 at 9:48
  • Using Linux / UNIX without graphics is the best solution, because it gives you control. The GUI is for noobs. Jun 26, 2019 at 18:30
  • I have googled this DNS problem all day, and nothing worked until I found askubuntu.com/a/1077479/231504 (sorry to post as a comment, but the question is "protected because it has attracted low-quality answers") Jul 29, 2019 at 1:14
  • supersede and prepend domain-name-servers not worked in my Ubuntu 16.04.6 LTS :-/ this irritating me why the developers complicate these things, why all Linux can not use just plain resolv.conf
    – 16851556
    Sep 9, 2020 at 22:52

The correct answer for this question is:

  1. Go to the Network icon in the top panel.

  2. Select Edit Connections.

  3. Open the connection that you wish to modify, e. g. Wired Connection.

  4. Select the IPv4 tab.

    1. Set the Method to Automatic (DHCP) addresses only.

    2. In the DNS Servers field, enter a comma-separated list of your DNS servers.

    3. Depending on your version of Ubuntu, if you see a switch called Automatic, switch it to OFF.

    4. Click the Save button.

Do not edit your resolv.conf file!

  • 1
    Thanks for th e clear, concise steps. I've set both Wifi and Ethernet and i will look forward to the settings remaining over time and reboots. Sep 6, 2016 at 16:12
  • 4
    Do we need a reboot? Or a configurable way to pick up changes?
    – Coder
    Apr 16, 2018 at 23:11
  • 2
    In ubuntu 18 (at least for me) no GUI changes I made to DNS would persist. The only way I managed to make my system prefer OpenDNS was "prepend domain-name-servers" as shown here: askubuntu.com/a/1077479/231504 (sorry to post as a comment, but the question is "protected because it has attracted low-quality answers") (if i get enough votes on this comment, i can attain the 10 points required to post an answer) Jul 29, 2019 at 1:16
  • +1 Up-to-date instructions, now for later Ubuntu versions, are also available from Cloudflare’s
    – caw
    Dec 12, 2019 at 2:08
  • Why do not edit?
    – kyb
    Jan 11, 2022 at 9:37

To use systemd resolvconf service, you can add name servers to the file...


...as you would in resolv.conf:


The file head is added to the /etc/resolv.conf by the resolconf service.

  • This file and folder does not exist in my Ubuntu 16.04.6 LTS
    – 16851556
    Sep 9, 2020 at 22:48
  • I'm running Ubuntu 16.04.7 LTS. The folder /etc/resolvconf/ and the /etc/resolvconf/resolv.conf.d/head file is installed by a package named resolconf. You presumably have some other means to manage the /etc/resolv.conf file, which is the back bone of DNS in Linux. Thus, this solution isn't for you?
    – Janne
    Sep 15, 2020 at 16:30
  • thx, i think the package is "resolvconf". Btw the file /etc/resolvconf/resolv.conf.d/head contains instruiction that it should not be editted by hand. Btw. do you know how to verify which open resolver IP is my Ubuntu using? Any command? request to verify/test?
    – 16851556
    Sep 16, 2020 at 17:21
  • I believe the warning in /etc/resolvconf/resolv.conf.d/head is only there to be copied to the /etc/resolv.conf, which thus is automatically updated by resolvconf. How about cat /etc/resolv.conf. @16851556
    – Janne
    Sep 24, 2020 at 20:52
  • This solution doesn't seem to work. Maybe at some point it will be copied to resolv.conf but it's certainly not happening instantly.
    – AndreKR
    Aug 3, 2021 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .