I have my desktop computer configured with a static IP address:
However, /etc/resolve.conf keeps getting overwritten with:
nameserver 127.0.0.1
search localdomain example.com
This seems to happen periodically or when I run sudo resolvconf -u
.
I would really like to get example.com
removed from the dns search domain list. I used to have it in there but its causing problems now. I just can't seem to get it out. I don't know where it is coming from or why it keeps getting put back. As far as I can grep, there is nothing referring to example.com
anywhere in my /etc directory anymore.
What is putting this search domain into my resolv.conf file and how can I prevent it from doing so?
For ipv4, @stalet's suggestion to edit
/etc/dhcp/dhclient.conf
should work; also try removingdomain-search
anddomain-name
from therequest
. Verify the settings worked in/var/lib/NetworkManager/dhclient-[connection-uuid]-[ifname].lease
.However, the unwanted search domain may be coming from the ipv6 dhcp server, as I found on 16.04/Xenial. If NetworkManager's
dhclient -6
command succeeds and the dhcp server sets search domains, NetworkManager will merge those into the ipv4 search domain list.A simple way to fix this on a connection-by-connection basis is to configure the connection's ipv6 settings to "Method: Automatic, addresses only" or even "Method: Ignore".
Setting this for each connection could become annoying, and I looked pretty hard but couldn't find a way to fix this globally. Adding
supersede dhcp6.domain-search
to and removingrequest dhcp6.domain-search
from/etc/dhcp/dhclient.conf
doesn't seem to help. Also, copying that file to/etc/dhcp/dhclient6.conf
caused NetworkManager to correctly template it to/var/lib/NetworkManager/dhclient6-[ifname].conf
, but NetworkManager insists on addingalso request dhcp6.domain-search;
, and the unwanted search domain is still added.The
search
content is provided by dhcp, and can be overridden in/etc/dhcp/dhclient.conf
by supersede these variables with empty values.Add these lines at the bottom of the
/etc/dhcp/dhclient.conf
To make the change affect your system you can reconnect to your network or just restart the network-manager service.
I saw an update to resolveconf 1.78ubuntu5 today (https://launchpad.net/ubuntu/xenial/+source/resolvconf/+changelog), referencing this Launchpad bug, https://bugs.launchpad.net/maas/+bug/1711760. Perhaps this issue is resolved now?