Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 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 xxx.xxx.xxx.xxx
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 at 10:59
    
Thanks, totally forgot that :) –  Pabi Jul 15 at 11:01
    
What do I change to the file for adding new DNS nameservers? –  Steven Roose Jul 15 at 11:03
    
(The file is empty when I try to edit it, is that correct?) –  Steven Roose Jul 15 at 11:05
    
It is okay that it is empty just write: nameserver xxx.xxx.xxx.xxx. –  Pabi Jul 15 at 11:06

Your Answer

 
discard

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.