5

On Linux Mint, when I view the /etc/resolv.conf file, the first comment states that the /etc/resolv.conf file is generated by resolvconf(8).

~ $ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

To paraphrase the resolvconf(8) man page, "the resolvconf program is run by DHCP clients such as dhclient".

I run dhclient wlan0.

~ $ dhclient wlan0

Dhclient should cause the resolvconf program to update /etc/resolv.conf. The /var/lib/dhcp/dhclient.leases file verifies that I am able to lease the IP address of the nameserver (192.168.0.6).

~ $ cat /var/lib/dhcp/dhclient.leases 
lease {
  interface "wlan0";
  . . .
  option domain-name-servers 192.168.0.6;
  . . .
}

However, the /etc/resolv.conf file is not updated. The /etc/resolv.conf file has nameserver 127.0.1.1.

~ $ 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 software.eng.apl

There are no nameservers listed in /etc/network/interfaces.

~ $ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

I am not sure what I am missing here to get the /etc/resolv.conf file to update using the nameserver being leased from the DHCP server. The DHCP server is a Linux CentOS machine using DHCPD.

  • Is /etc/resolv.conf a file or a symlink? – fpmurphy Apr 16 '17 at 2:06
  • It looks like /etc/resolv.conf is symbolically linked to /run/resolvconf/resolv.conf. Both files are identical. Thanks for the suggestion. I'll chase this and see if it turns into an answer to the problem. – JeremyCanfield Apr 16 '17 at 2:44
  • 1
    With nameserver 127.0.1.1, you are running some kind of nameserver or DNS proxy yourself. That proxy in turn will use the nameserver provided by dhclient. If you really want this to be visible in resolv.conf, disable your DNS proxy. – dirkt Apr 16 '17 at 5:19
  • Possibly the same issue: unix.stackexchange.com/questions/175526/… – Kusalananda Apr 16 '17 at 7:27
7

Mint and other modern distros ship with mdns by default, which wraps the regular public DNS with a local "decentralized" wrapper which enables zeroconf support for your local network. Basically, a local DNS server resolves names in the local network it has discovered, then falls back to the (now proxied) public DNS for public Internet resolution, i.e. for names outside of your local network.

In so many words, your resolv.conf is correct and appropriate for this scenario, and if mdns has problems accessing your ISP's nameserver, you should look inside its configuration - though of course, if you don't care about zeroconf support, disabling mdns (and then probably also Avahi) lets you manage resolv.conf in the traditional fashion.

See also e.g. https://help.ubuntu.com/community/HowToZeroconf

  • Fascinating. Thank you very much for sharing this intel around mdns. I sure am glad there is a logic reason for this behavior. I apologize, I do not yet have enough reputation to up-vote your answer. – JeremyCanfield Apr 16 '17 at 12:47
0

I had the same problem as described in the OP but none of the previous answers worked for me. I'm running Linux Mint 18 and I discovered this problem when trying to use networking features inside a docker container. Docker was expecting to resolve DNS values from /etc/resolv.conf. But since the only nameserver listed was 127.0.1.1, docker networking was unsuccessful.

I found another solution on askubuntu that worked for me. I'm posting it here as a cross reference in case it helps someone.


NetworkManager is the program which (via the resolvconf utility) inserts address 127.0.1.1 into resolv.conf. NetworkManager 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 not to start a dnsmasq instance and not to insert that address. In /etc/NetworkManager/NetworkManager.conf comment out the line dns=dnsmasq

sudo vim /etc/NetworkManager/NetworkManager.conf

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

and restart the NetworkManager service.

sudo service network-manager restart

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 vim /etc/resolv.conf   # Create static file
-1

you can edit /etc/dhcp/dhclient.conf edit the line by uncommenting #prepend domain-name-server

  • Can you explain how this answers the question? – Stephen Rauch Aug 3 '17 at 14:37
  • using prepend domain-name-server allows you to add custom domain name servers – stephen ngetich Aug 3 '17 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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