4

I have a query on the purpose of the resolv.conf file.

If I delete the name server entry from the /etc/resolv.conf file, my browser still able to do the DNS query. As far as I know, any URL is first looked up in the name server which is listed on this file.

I read somewhere that if the resolv.conf entry is set to localhost then it means that the name server is running in the local host. Can someone point out which is that service?

After removing the name server entry from the resolv.conf, the commands like nslookup are not working as expected. However when I try to open a site from the browser, I see in the wireshark that the request is still sent to the same name server IP though I removed it from the resolv.conf file. This clearly means that there is some other name server service running.

Any help?

1 Answer 1

2

Network Manager uses dynamically your /etc/resolv.conf with dnsmasq. Each connection can have our dns server listed.

If you wish to avoid this behavior you can do this

In /etc/NetworkManager/NetworkManager.conf comment out the dns=dnsmasq

sudo nano /etc/NetworkManager/NetworkManager.conf

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

no-auto-default=00:22:64:4E:6F:70,

[ifupdown]
managed=fals

and restart the NM service

sudo restart network-manager

With this /etc/resolv.conf is no longer dependant on resolvconf package and is updated based on the DNS entries of each connection in the Network Manager

Also you can add nameserver in /etc/resolv.conf. If you have not set dns in NM per connection this will be used

sudo nano /etc/resolv.conf

nameserver 8.8.4.4
nameserver 8.8.8.8

You can stop and disable the resolvconf service and only use static defined dns servers from /etc/resolv.conf

Stop the service resolvconf

sudo service resolvconf stop

disable it

sudo update-rc.d resolvconf disable

disable resolvconf to overwrite resolv.conf

create /etc/init/resolvconf.override with single line manual

echo 'manual' | sudo tee /etc/init/resolvconf.override

remove symbolic link /etc/resolv.conf

rm /etc/resolv.conf

create resolv.conf with static dns entry

echo "namserver x.x.x.x." > /etc/resolv.conf
3
  • Thank you very much for your reply. However, I am still not clear how will be the browser resolve say www.google.com if I remove the name server entry from the resolve.conf? May 25, 2015 at 11:34
  • Also I even removed dns-nameservers the entry from my /etc/network/interfaces file, but still the browser is able to resolve. Is there any other way it does the dns lookup? May 25, 2015 at 11:52
  • On you ubuntu in NM have in the connection setup configured DNS server. Based on route, maybe is better to say, on witch connection traffic is routed ubuntu use that DNS and with dnsmasq make dynamic entry in /etc/resolv.conf. If you remove all dns setting from connection in NM you wouldn't be able to resolve logical names. To avoid that you can use static dns servers witch will resolve names and way to do that I write in answer.
    – 2707974
    May 25, 2015 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .