I have two buster servers that get assigned static IPs via DHCP (dhclient). the DHCP server assigns all parameters including domain (mydomain.org). One server works fine, i.e. hostname -f
. On this server /etc/resolv.conf
is correct:
# Generated by NetworkManager
search mydomain.org
nameserver x.x.x.x
hostname -f
on the working server returns the FQDN as it should.
But the other server doesn't get the domain properly. hostname -f
simply returns the hostname and /etc/resolv.conf
isn't populated as per the DHCP settings:
# Generated by NetworkManager
search lan
nameserver x.x.x.x
If I manually run sudo dhclient -4 -v
/etc/resolv.conf gets updated properly with search mydomain.org
. However, after a restart or systemctl restart NetworkManager
/etc/resolv.conf
returns to the incorrect state.
What am I missing here? How do I get networkmanager to properly assign the search domain in /etc/resolv.conf
?
Turns out NetworkManager looks at config files in
/etc/NetworkManager/system-connections
. Looking at the fileWired Connection 1
in that folder, I found some static assignments under the [ipv4] heading, specifically the problem was with this line:removing that line and restarting NetworkManager with
systemctl restart NetworkManager
fixed the problem.