3

I want to use OpenDNS and I want to set things up using the command line, I thought that I should edit the /etc/resolv.conf file but the file starts with a comment stating:

DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

So how do I set up OpenDSN in Ubuntu 15.10?

  • You could also consider installing unbound, and using 127.0.0.1 as preferred dns ! – Kwaadpepper Oct 27 '15 at 10:19
3

NetworkManager is the program which (via the resolvconf utility) inserts address 127.0.1.1 into resolv.conf. NM inserts that address if and only if it is configured to start an instance of the dnsmasq program to serve as a local forwarding nameserver. That dnsmasq instance listens for queries at address 127.0.1.1.

If you do not want to use a local forwarding nameserver, then configure NetworkManager so it doesn't start a dnsmasq instance nor inserts that address. In /etc/NetworkManager/NetworkManager.conf comment out the line dns=dnsmasq

sudo nano /etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq

and restart the NetworkManager service.

sudo restart network-manager

In this mode, NetworkManager updates /etc/resolv.conf (still via resolvconf) to include the nameserver addresses NetworkManager has for active connections.

If you want to disable the resolvconf mechanism for updating resolv.conf and just use a static resolv.conf file, do the following.

sudo rm -f /etc/resolv.conf  # Delete the symbolic link
sudo nano /etc/resolv.conf   # Create static file

# Content of static resolv.conf
nameserver 208.67.220.220
nameserver 208.67.220.222
0

The previous answer is perfect but to restart the network-manager you have to type this:

sudo service network-manager restart
  • 2
    The answer indeed perfect and includes that same command. – user589808 Feb 13 '17 at 12:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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