How do I Permanently configure the DNS server list in 16.04?

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 123.123.123.123 # 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.

/etc/dhcp/dhclient.conf:
supersede domain-name-servers 123.123.123.123 # 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).


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!

Tags:

Networking