dhclient – Fix Dhclient Not Updating /etc/resolv.conf

dhclientdhcpresolv.conf

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.

Best Answer

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

Related Question