DHCLIENT.CONF(5)

NAME
dhclient.conf - dhcp client configuration

SYNOPSIS
/etc/dhclient.${mac}.conf
/etc/dhclient.${if}.conf
/etc/dhclient.conf

DESCRIPTION
dhclient(8) configures the network interface according to its dhclient.conf configuration file, searching for the first file path to exist:

•   /etc/dhclient.${mac}.conf - where mac is the network interface's hardware address. (Example: dhclient.00:00:5e:00:53:00.conf)
•   /etc/dhclient.${if}.conf - where if is the network interface's name. (Example: dhclient.if0.conf)
•   /etc/dhclient.conf - the shared configuration file.

Network interface names are not guaranteed to be stable and it's recommended to use the hardware address in the file name or in the if statement in the shared file.

FORMAT
dhclient.conf contains a series of whitespace delimited tokens akin to an ifconfig(8) invocation. The ‘#’ character begins a comment and the rest of the line is ignored. If a token names a protocol, then that protocol is selected. If a token names a configuration inside the current protocol or a top level statement, then that configuration is set to the value of the subsequent token.

Configurations can be generally be set to either a manual value, or auto to obtain the value from the DHCP server, or none to disable setting the configuration and retain the currently set value. If auto or none follows a protocol name, then all the configurations inside the protocol is set to that value.

The top level statements are:

if [name | etherhw:mac | id:linkid]
    The following configurations only applies to the network interface if it matches by its name, its hardware address mac, or its unstable index number linkid. The if statement can only be used in the shared /etc/dhclient.conf file and allows defining a section for each network interface. Configurations are applied to all network interfaces until the if statement appears.

The inet protocol contains the following configurations:

address [ip | auto | none]
    The local address in inet(4) address notation. (Default: auto)

router [ip | auto | none]
    The default route in inet(4) address notation. (Default: auto)

subnet [ip | auto | none]
    The subnet mask in inet(4) address notation. (Default: auto)

The dns protocol contains the following configurations:

servers [ip1,ip2,... | auto | none]
    The comma separated list of DNS servers in inet(4) address notation. A singular comma means the empty list. (Default: auto)

The ether protocol contains the following configurations:

address [mac | auto | none]
    The local address in ether(4) address notation. auto sets it to the hardware address. (Default: auto)

EXAMPLES

  Manually configuring an interface
To fully manually configure the network interface if0, even if the network interface's device name changes over time, first first look up its ethernet hardware address:

    $ ifconfig -l if0 ether hwaddress
    00:00:5e:00:53:00

Then write an /etc/dhclient.conf section using the if statement:

    if etherhw:00:00:5e:00:53:00
    inet address 192.0.2.4 router 192.0.2.1 subnet 255.255.255.0
    dns servers 192.0.2.2 192.0.2.3

  Obtaining the DNS servers on only one interface
The DNS server list is global and a system with multiple network interfaces can obtain the list on only the preferred interface by disabling DNS configuration and enabling it on the desired interface:

    dns none
    if etherhw:00:00:5e:00:53:00
    dns auto

  Disabling dhclient
dhclient(8) can be disabled on an interface by disabling configuration of the inet and dns protocols:

    inet none
    dns none

SEE ALSO
ether(4), if(4), inet(4), dhclient(8), dnsconfig(8), ifconfig(8)

CAVEATS
The list of DNS servers is global and should only be obtained on one network interface to avoid interference.