Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The only consistent solution for changing your DNS server is to change it in each individual network interface. This means for Ethernet and for each wireless network you use.

I'm looking for a way to set DNS servers globally. No matter what interface I'm using. I found several solutions but most of them are commented on that they only work on certain conditions.

Because I don't really know a way to test if the DNS settings were succesfully changed, I'm looking for a way that definitely works on Ubuntu 14.04 LTS.

share|improve this question
up vote 6 down vote accepted

You can use resolvconf if it isn't already installed use: sudo apt-get install resolvconf.

Then edit the config file: sudo nano /etc/resolvconf/resolv.conf.d/base.
Enter your nameserves (one per line) with: nameserver
Update resolvconf with sudo resolvconf -u

Changes should be permanent and for all interfaces.

share|improve this answer
You need to update resolvconf for the settings to be applied. sudo resolvconf -u – NGRhodes Jul 15 '14 at 10:59
Thanks, totally forgot that :) – Pabi Jul 15 '14 at 11:01
What do I change to the file for adding new DNS nameservers? – Steven Roose Jul 15 '14 at 11:03
(The file is empty when I try to edit it, is that correct?) – Steven Roose Jul 15 '14 at 11:05
It is okay that it is empty just write: nameserver – Pabi Jul 15 '14 at 11:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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