How to change the DNS server across network interfaces?

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.