This article will describe how to avoid nameserver 127.0.0.1 in /etc/resolv.conf.
1 nameserver 127.0.0.1
nameserver 127.0.0.1 is written to /etc/resolv.conf by default. And nameservers from DHCP server is not written to /etc/resolv.conf.
If you use multiple DNS server for private network and internet, nameserver 127.0.0.1 does not resolve host name.
$ cat /etc/resolv.conf # 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 127.0.1.1 search hiroom2.com
2 Disable NetworkManager dns=dnsmasq
Disable NetworkManager dns=dnsmasq and reboot. The nameservers from DHCP server will be written to /etc/resolv.conf.
$ sudo sed -e 's/^dns=dnsmasq/#dns=dnsmasq/g' \ -i /etc/NetworkManager/NetworkManager.conf $ sudo reboot