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.


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 xxx.xxx.xxx.xxx
Update resolvconf with sudo resolvconf -u

Changes should be permanent and for all interfaces.

  • You need to update resolvconf for the settings to be applied. sudo resolvconf -u – NGRhodes Jul 15 '14 at 10:59
  • 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 xxx.xxx.xxx.xxx. – Pabi Jul 15 '14 at 11:06
  • Pabi, might be worth updating your answer with further details added in these comments :) – NGRhodes Jul 15 '14 at 11:23

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.