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.
headthat you should modify asresolv.confthe file itself explains that it will be OVERWRITTEN. Its thetailthat should work on.. Can you please try this solution and let me know whether it helps! – AzkerM Jan 02 '16 at 17:59headfile itself is not overwritten, theheadfile is going to be used to generate/etc/resolv.conf. I was already aware of the purpose of port 53. Restarting NetworkManager is not helping. I have the impression that you didn't understand my problem, maybe reading my post again would help, especially where I describe the unwantednameserver 127.0.1.1directive. – fstab Jan 02 '16 at 18:03/etc/dhcp/dhclient.conffile. Basically it takes whatever nameserver router provides, and replaces that with our own. Want me to post it as an answer ? I've posted it before, I'll link if I can, otherwise - I might post – Sergiy Kolodyazhnyy Jan 02 '16 at 18:09resolv.conffile actually. However, its the network-manager which writes into the file. You can find more here -> http://askubuntu.com/a/627900/179042 – AzkerM Jan 02 '16 at 18:12resolv.confrefers to a localhost, it makes no sense to alter configurations of how the DHCP information is used, as the DHCP server surely would not indicate localhost as dns server. – fstab Jan 02 '16 at 18:14dns=none– Sergiy Kolodyazhnyy Jan 02 '16 at 18:52