Dhclient not updating /etc/resolv.conf
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 videos on Youtube
JeremyCanfield
Updated on September 18, 2022Comments
-
JeremyCanfield over 1 year
On Linux Mint, when I view the
/etc/resolv.conf
file, the first comment states that the/etc/resolv.conf
file is generated byresolvconf(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.-
fpmurphy about 7 yearsIs
/etc/resolv.conf
a file or a symlink? -
JeremyCanfield about 7 yearsIt 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. -
dirkt about 7 yearsWith
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 bydhclient
. If you really want this to be visible inresolv.conf
, disable your DNS proxy. -
Kusalananda about 7 yearsPossibly the same issue: unix.stackexchange.com/questions/175526/…
-
-
JeremyCanfield about 7 yearsFascinating. 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. -
Stephen Rauch almost 7 yearsCan you explain how this answers the question?
-
Stephen Ng'etich almost 7 yearsusing
prepend domain-name-server
allows you to add custom domain name servers