In Debian Linux, when a network interface is configured to obtain an IP address automatically, the DHCP client utility writes the values received from the server over the content of file /etc/resolv.conf. Thus, custom entries that were saved in this file, typically domain suffixes and domain name servers, are lost. If you need DHCP but also want to keep your configuration, do this:

  1. Edit file /etc/dhcp/dhclient.conf.
  2. Add the following lines, adjusting the values to match your needs.
supersede domain-name "my-domain.com";
supersede domain-search "my-domain.com";
prepend domain-name-servers 9.9.9.9;

This example specifies my-domain.com as the domain suffix, overriding whatever value is sent by the DCHP server. The value of the domain-search setting is appended to hostnames to form fully-qualified domain names. For example, if you try to connect to hostname foo (without a domain name), the DNS will be queried for the FQDN foo.my-domain.com.

The example also sets the domain name server 9.9.9.9 to take priority over domain name servers provided by a DHCP server.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.