I have my desktop computer configured with a static IP address:

However, /etc/resolve.conf keeps getting overwritten with:

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?

  • Whats the output of sudo grep -rn example.com /etc/network/interfaces /etc/NetworkManager/system-connections /etc/resolvconf/ ?
    – heemayl
    Apr 8, 2016 at 18:42
  • example.com is not found in any of those locations. Apr 8, 2016 at 18:47
  • It is possible that a DHCP server is providing it, but I'm not sure how to check that, nor to disable it if that is actually the case. I would already expect not be using DHCP because I have tried to configure the IP as static. Apr 8, 2016 at 18:48
  • not sure if it is related. But, I've had a file named "hyphen" within my home directory under firefox, where it was hard linked to<port>. It's entirely possible that 127 has been taken over by malware.
    – Miphix
    Apr 8, 2016 at 18:51
  • 1
    Look in the files under /run/resolvconf/interface. The line "search example.com" or "domain example.com" probably appears in one of those files. The name of the file indicates the source of the information.
    – jdthood
    Apr 14, 2016 at 10:32

3 Answers 3


For ipv4, @stalet's suggestion to edit /etc/dhcp/dhclient.conf should work; also try removing domain-search and domain-name from the request. 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 removing request 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 adding also request dhcp6.domain-search;, and the unwanted search domain is still added.

  • just removing domain-name from the request then doing ifdown eth0 && ifup eth0 worked for me on amazon EC2
    – dw1
    Nov 3, 2018 at 17:29

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

supersede domain-name "";
supersede domain-search "";
supersede search "";

To make the change affect your system you can reconnect to your network or just restart the network-manager service.

sudo service network-manager restart
  • 2
    Even after following those instructions, example.com remains in the search section of /etc/resolve.conf. Mar 27, 2017 at 13:27
  • Same. In my case I've tried to add search entries with prepend/append search and this had no effect on it.
    – Dan M.
    Jul 16, 2021 at 14:58

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?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .