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 you had 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:
- Edit file /etc/dhcp/dhclient.conf.
- 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 22.214.171.124;
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 126.96.36.199 to take priority over domain name servers provided by a DHCP server.