I am trying to change the nameservers being used by my Ubuntu machine (just my laptop, not a server).
In the good old days in which I was using Slackware I just needed to edit /etc/resolv.conf and my job was done.
After figuring out that /etc/resolv.conf is actually generated by resolvconf I edited /etc/resolvconf/resolv.conf.d/head as such:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
But my job is not done. I see that an unwanted line is still added in /etc/resolv.conf:
nameserver 127.0.1.1
I don't like this because I want the name resolution to fail just after trying Google's nameservers.
This line isn't in any file in /etc/resolvconf/resolv.conf.d/ and here my confusion begins. By sudo netstat -ltnp I see that I have a name server daemon running on my laptop:
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 4889/dnsmasq
Why would I need that? I cannot remove the package containing dnsmasq (which is dnsmasq-base) because these packages depend on it:
checkbox-gui checkbox-qt dnsmasq-base network-manager network-manager-gnome plainbox-provider-checkbox plainbox-provider-resource-generic ubuntu-desktop
Is this service running on port 53 really necessary to the well-being of my machine? How can I prevent it from running without using GUI tools and without compromising NetworkManager?
Attempt to a solution
Tried altering /etc/NetworkManager/NetworkManager.conf and restarting NetworkManager by commenting the line referring to dnsmasq
[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq
[ifupdown]
managed=false
The aforementioned unwanted line in resolv.conf did indeed disappear. But, unfortunately it seems to be replaced to this line:
nameserver 192.168.0.1
Would be nice to have some elucidation on the meaning and purpose of such behavior.
A temporary fix is to remove the link /etc/resolv.conf -> ../run/resolvconf/resolv.conf and creating a new /etc/resolv.conf file from scratch. This would work.. somewhat. It would not add other useful name informations (such as the search directives) that come from the DHCP.
So, a definitive solution that allows resolv.conf to be generated by resolvconf or NetworkManager still needs to be found.