dhcpcd.conf man page
dhcpcd.conf — dhcpcd configuration file
Although dhcpcd can do everything from the command line, there are cases where it's just easier to do it once in a configuration file. Most of the options found in dhcpcd(8) can be used here. The first word on the line is the option and the rest of the line is the value. Leading and trailing whitespace for the option and value are trimmed. You can escape characters in the value using the \ character. Comments can be prefixed with the # character. String values should be quoted with the " character.
Here's a list of available options:
When discovering interfaces, the interface name must match
patternwhich is a space or comma separated list of patterns passed to fnmatch(3). If the same interface is matched in
denyinterfacesthen it is still denied.
When discovering interfaces, the interface name must not match
patternwhich is a space or comma separated list of patterns passed to fnmatch(3).
dhcpcd will arping each address in order before attempting DHCP. If an address is found, we will select the replying hardware address as the profile, otherwise the ip address. Example:
# My specific 192.168.0.1 network
# A generic 192.168.0.1 network
Authenticate DHCP messages. See the Supported Authentication Protocols section.
Define a shared key for use in authentication.
realm can be to for use with the
expireis the date the token expires and should be formatted "yyy-mm-dd HH:MM". You can use the keyword
0which means the token never expires. For the token protocol,
secretidneeds to be 0 and
realmneeds to be "". If dhcpcd has the error
dhcp_auth_encode: Invalid argumentthen it means that dhcpcd could not find the correct authentication token in your configuration.
Background immediately. This is useful for startup scripts which don't disable link messages for carrier status.
Ignores all packets from
Only accept packets from
blacklistis ignored if
Be a BOOTP client. Basically, this just doesn't send a DHCP Message Type option and will only interact with a BOOTP server. All other DHCP options still work.
Instructs the DHCP server to broadcast replies back to the client. Normally this is only set for non Ethernet interfaces, such as FireWire and InfiniBand. In most cases, dhcpcd will set this automatically.
Sets the group ownership of
/var/run/dhcpcd.sockso that users other than root can connect to dhcpcd.
Echo debug messages to the stderr and syslog.
/devmanagement module. dhcpcd will load the first one found to work, if any.
valueto the environment for use in dhcpcd-run-hooks(8). For example, you can force the hostname hook to always set the hostname with
envforce_hostname=YES. Or set which driver wpa_supplicant(8) should use with
If the hostname is set, it will be will set to the FQDN if possible as per RFC 4702 section 3.1. If the FQDN option is missing, dhcpcd will still try and set a FQDN from the hostname and domain options for consistency. To override this, set
envhostname_fqdn=[YES|NO|SERVER]. A value of server means just what the server says, don't manipulate it. This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network where the DHCPv4 hostname is short and the DHCPv6 has an FQDN. DHCPv6 has no hostname option.
clientid. If the string is of the format 01:02:03 then it is encoded as hex. For interfaces whose hardware address is longer than 8 bytes, or if the
clientidis an empty string then dhcpcd sends a default
clientidof the hardware family and the hardware address.
Generate an RFC 4361. compliant DHCP Unique Identifier. If persistent storage is available then a DUID-LLT (link local address + time) is generated, otherwise DUID-LL is generated (link local address). This, plus the IAID will be used as the
clientid. The DUID-LLT generated will be held in
/etc/dhcpcd.duidand should not be copied to other hosts.
Set the Interface Association Identifier to
iaid. This option must be used in an
interfaceblock. This defaults to the last 4 bytes of the hardware address assigned to the interface. Each instance of this should be unique within the scope of the client and dhcpcd warns if a conflict is detected. If there is a conflict, it is only a problem if the conflicted IAIDs are used on the same network.
Enable DHCP on the interface, on by default.
Enable DHCPv6 on the interface, on by default.
Enable IPv4 on the interface, on by default.
Enable IPv6 on the interface, on by default.
addressin the DHCP DISCOVER message. There is no guarantee this is the address the DHCP server will actually give. If no
addressis given then the first address currently assigned to the
requestas above, but sends a DHCP INFORM instead of DISCOVER/REQUEST. This does not get a lease as such, just notifies the DHCP server of the
addressin use. You should also include the optional
cidrnetwork number in case the address is not already configured on the interface. dhcpcd remains running and pretends it has an infinite lease. dhcpcd will not de-configure the interface when it exits. If dhcpcd fails to contact a DHCP server then it returns a failure instead of falling back on IPv4LL.
Performs a DHCPv6 Information Request. No address is requested or specified, but all other DHCPv6 options are allowed. This is normally performed automatically when the IPv6 Router Advertises that the client should perform this operation. This option is only needed when dhcpcd is not processing IPv6RA messages and the need for DHCPv6 Information Request exists.
dhcpcd normally de-configures the interface and configuration when it exits. Sometimes, this isn't desirable if, for example, you have root mounted over NFS or SSH clients connect to this host and they need to be notified of the host shutting down. You can use this option to stop this from happening.
Fallback to using this profile if DHCP fails. This allows you to configure a static profile instead of using ZeroConf.
Sends the hostname
nameto the DHCP server so it can be registered in DNS. If
nameis an empty string then the current system hostname is sent. If
nameis a FQDN (ie, contains a .) then it will be encoded as such.
Sends the short hostname to the DHCP server instead of the FQDN. This is useful because DHCP servers will not register the FQDN in their DNS if the domain part does not match theirs.
Also, see the
envoption above to control how the hostname is set on the host.
Request a DHCPv6 Normal Address for
iaiddefaults to the
iaidoption as described above. You can request more than one ia_na by specifying a unique
iaidfor each one.
Request a DHCPv6 Temporary Address for
iaid. You can request more than one ia_ta by specifying a unique
iaidfor each one.
Request a DHCPv6 Delegated Prefix for
iaid. This option must be used in an
interfaceblock. Unless a
sla_idof 0 is assigned with the same resultant prefix length as the delegation, a reject route is installed for the Delegated Prefix to stop unallocated addresses being resolved upstream. If no
interfaceis given then we will assign a prefix to every other interface with a
sla_idequivalent to the interface index assigned by the OS. Otherwise addresses are only assigned for each
sla_id. Each assigned address will have a
suffix, defaulting to 1. If the
suffixis 0 then a slaac address is assigned. You cannot assign a prefix to the requesting interface unless the DHCPv6 server supports
RFC6603Prefix Exclude Option. dhcpcd has to be running for all the interfaces it is delegating to. A default
prefix_lenof 64 is assumed, unless the maximum
sla_iddoes not fit. In this case
prefix_lenis increased to the highest multiple of 8 that can accommodate the
sla_idis an integer which must be unique inside the
iaidand is added to the prefix which must fit inside
prefix_lenless the length of the delegated prefix. You can specify multiple
ia_pd, space separated. IPv6RS should be disabled globally when requesting a Prefix Delegation.
In the following example eth0 is the externally facing interface to be configured for both IPv4 and IPv6. The DHCPv4 server will provide us with an IPv4 address and a default route. The DHCPv6 server is going to provide us with an IPv6 address, a default route and a /64 subnet to be delegated to the internal interface. The eth1 interface will be automatically configured for IPv6 using the first address (::1) from the delegated prefix. A second prefix is requested and assigned to two other interfaces. rtadvd(8) can be used with an empty configuration file on eth1, eth2 and eth3, to provide automatic IPv6 address configuration for the internal network.
noipv6rs # disable routing solicitation denyinterfaces eth2 # Don't touch eth2 at all interface eth0 ipv6rs # enable routing solicitation get the # default IPv6 route ia_na 1 # request an IPv6 address ia_pd 2 eth1/0 # request a PD and assign it to eth1 ia_pd 3 eth2/1 eth3/2 # req a PD and assign it to eth2 and eth3
Only configure IPv4.
Only confgiure IPv6.
fqdn[disable | ptr | both]
ptr just asks the DHCP server to update the PTR record of the host in DNS whereas both also updates the A record. disable will disable the FQDN option. The default is both. dhcpcd itself never does any DNS updates. dhcpcd encodes the FQDN hostname as specified in
Subsequent options are only parsed for this
Generate SLAAC addresses for each Prefix advertised by a Router Advertisement message with the Auto flag set. On by default.
Disables the above option.
By default, when dhcpcd receives an IPv6 RA, dhcpcd will only fork to the background if the RA contains at least one unexpired RDNSS option and a valid prefix or no DHCPv6 instruction. Set this option so to make dhcpcd always fork on an RA.
Disables kernel IPv6 Router Advertisement processing so dhcpcd can manage addresses and routes.
Each time dhcpcd receives an IPv6 Router Adveristment, dhcpcd will manage the default route only. This allows dhcpcd to prefer an interface for outbound traffic based on metric and/or user selection rather than the kernel.
Enables IPv6 Router Advertisement solicitation. This is on by default, but is documented here in the case where it is disabled globally but needs to be enabled for one interface.
Request a leasetime of
Writes to the specified
logfilerather than syslog(3). The
logfileis truncated when opened and is reopened when dhcpcd receives the SIGUSR2 signal.
Metrics are used to prefer an interface over another one, lowest wins. dhcpcd will supply a default metric of 200 + if_nametoindex(3). An extra 100 will be added for wireless interfaces.
Any pre-existing IPv4 addresses existing address will be removed from the interface when adding a new IPv4 address.
Don't send any ARP requests. This also disables IPv4LL.
Don't require authentication even though we requested it. Also allows FORCERENEW and RECONFIGURE messages without authentication.
Don't delay for an initial randomised time when starting protocols.
Don't start DHCP or listen to DHCP messages. This is only useful when allowing IPv4LL.
Don't start DHCPv6 or listen to DHCPv6 messages. Normally DHCPv6 is started by a RA instruction or configuration.
Don't install any default routes.
Install a default route if available (default).
Don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with
So to stop dhcpcd from touching your DNS settings or starting wpa_supplicant you would do:-
nohook resolv.conf, wpa_supplicant
Don't attempt to configure an IPv4 address.
Don't attempt to obtain an IPv4LL address if we failed to get one via DHCP. See RFC 3927.
Don't attmept to configure an IPv6 address.
Disable solicitation and receipt of IPv6 Router Advertisements.
Don't receive link messages about carrier status. You should only set this for buggy interface drivers.
Don't bring the interface up when in master mode. If dhcpcd.conf cannot determine the carrier state, dhcpcd.conf will enter a tight polling loop until the interface is marked up and running or a valid carrier state is reported.
optionfrom the server. It can be a variable to be used in dhcpcd-run-hooks(8) or the numerical value. You can specify more
options separated by commas, spaces or more
optionPrepend dhcp6_ to
optionto request a DHCPv6 option. If no DHCPv6 options are configured, then DHCPv4 options are mapped to equivalent DHCPv6 options.
Prepend nd_ to
optionto handle ND options, but this only works for the
To see a list of options you can use, call dhcpcd with the -V, --variables argument.
Remove the option from the message before it's processed.
optionto be present in all messages, otherwise the message is ignored. To enforce that dhcpcd only responds to DHCP servers and not BOOTP servers, you can
dhcp_message_type. This isn't an exact science though because a BOOTP server can send DHCP like options.
Reject a message that contains the
option. This is useful when you cannot use
requireto select / de-select BOOTP messages.
If dhcpcd.conf detects an address added to a point to point interface (PPP, TUN, etc) then it will set the listed DHCP options to the destination address of the interface.
Subsequent options are only parsed for this profile
Suppress any dhcpcd output to the console, except for errors.
rebootseconds before moving to the DISCOVER phase if we have an old lease to use and moving from DISCOVER to IPv4LL if no reply. The default is 5 seconds. A setting of 0 seconds causes dhcpcd to skip the REBOOT phase and go straight into DISCOVER. This is desirable for mobile users because if you change from network A to network B and they use the same subnet and the address from network A isn't in use on network B, then the DHCP server will remain silent even if authoritative which means dhcpcd will timeout before moving back to the DISCOVER phase.
dhcpcd will release the lease prior to stopping the interface.
scriptinstead of the default
Subsequent options are only parsed for this wireless
Selects the interface identifier used for SLAAC generated IPv6 addresses. If
privateis used, a RFC7217 address is generated.
Configures a static
value. If you set
ip_addressthen dhcpcd will not attempt to obtain a lease and just use the value for the address with an infinite lease time. If you set
ip6_address, dhcpcd will continue auto-configuation as normal.
Here is an example which configures two static address, an IPv4 router, DNS and disables IPv6 auto-configuration. You could also use the
inform6command here if you wished to obtain more information via DHCPv6. For IPv4, you should use the
ipaddressoption instead of setting a static address.
static domain_name_servers=192.168.0.1 fd51:42f8:caae:d92e::1
Here is an example for PPP which gives the destination a default route. It uses the special destination keyword to insert the destination address into the value.
seconds, instead of the default 30. A setting of 0
secondscauses dhcpcd to wait forever to get a lease. If dhcpcd is working on a single interface then dhcpcd will exit when a timeout occurs, otherwise dhcpcd will fork into the background. If using IPv4LL then dhcpcd start the IPv4LL process after the timeout and then wait a little longer before really timing out.
Tag the DHCPv4 messages with the userclass. You can specify more than one.
Add an encapsulated vendor option.
codeshould be between 1 and 254 inclusive. To add a raw vendor string, omit
codebut keep the comma. Examples.
Set the vendor option 01 with an IP address.
vendor 01,192.168.0.2Set the vendor option 02 with a hex code.
vendor 02,01:02:03:04:05Set the vendor option 03 with an IP address as a string.
vendor 03,\"192.168.0.2\"Set un-encapsulated vendor option to hello world.
vendor ,"hello world"
Set the DHCP Vendor Class. DHCPv6 has it's own option as shown below. The default is dhcpcd-<version>:<os>:<machine>:<platform>. For example
dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386If not set then none is sent. Some badly configured DHCP servers reject unknown vendorclassids. To work around it, try and impersonate Windows by using the MSFT vendorclassid.
Add the DHCPv6 Vendor Indetifying Vendor Class with the IANA assigned Enterprise Number
data. This option can be set more than once to add more data, but the behaviour, as per RFC(3925) is undefined if the Enterprise Number differs.
waitip[4 | 6]
Wait for an address to be assigned before forking to the background. 4 means wait for an IPv4 address to be assigned. 6 means wait for an IPv6 address to be assigned. If no argument is given, dhcpcd.conf will wait for any address protocol to be assigned. It is possible to wait for more than one address protocol and dhcpcd.conf will only fork to the background when all waiting conditions are satisfied.
Use the last four bytes of the hardware address as the DHCP xid instead of a randomly generated number.
Defining new options
DHCP, ND and DHCPv6 allow for the use of custom options. Each option needs to be started with the
define6 directive. This can optionally be followed by both
encap options. Both can be specified more than once and
embed must come before
Defines the DHCP option
typewith a name of
variableexported to dhcpcd-run-hooks(8).
Defines the ND option
typewith a name of
variableexported to dhcpcd-run-hooks(8), with a prefix of _nd.
Defines the DHCPv6 option
typewith a name of
variableexported to dhcpcd-run-hooks(8), with a prefix of _dhcp6.
Defines the Vendor-Identifying Vendor Options. The
codeis the IANA Enterprise Number which will unqiuely describe the encapsulated options.
variablenames the Vendor option to be exported.
Defines an embedded variable within the defined option. The length is determined by the
type. If the
variableis not the same as defined in the parent option, it is prefixed with the parent
variablefirst with an underscore. If the
variablehas the name of
reservedthen it is not processed.
Defines an encapsulated variable within the defined option. The length is determined by the
type. If the
variableis not the same as defined in the parent option, it is prefixed with the parent
variablefirst with an underscore.
These keywords come before the type itself, to describe it more fully. You can use more than one, but they must appear in the order listed below. Requests the option by default without having to be specified in user configuration This option cannot be requested, regardless of user configuration This option is optional. Only makes sense for embedded options where like the client FQDN option where the FQDN string itself is optional. The option can appear more than once and will be indexed. The option data is split into a space separated array, each element being the same type.
These keywords come before the type itself, to describe it more fully. You can use more than one, but they must appear in the order listed below.
Requests the option by default without having to be specified in user configuration
This option cannot be requested, regardless of user configuration
This option is optional. Only makes sense for embedded options where like the client FQDN option where the FQDN string itself is optional.
The option can appear more than once and will be indexed.
The option data is split into a space separated array, each element being the same type.
The type directly affects the length of data consumed inside the option. Any remaining data is normally discarded. Lengths can be specified for string and binhex types, but this is generally with other data embedded afterwards in the same option. An IPv4 address, 4 bytes. An IPv6 address, 16 bytes. A NVT ASCII string of printable characters. A byte. A byte represented as a string of flags, most significant bit first. For example, using ABCDEFGH then A would equal 10000000, B 01000000, C 00100000, etc. If the bit is not set, the flag is not printed. A flag of 0 is not printed even if the bit postition is set. This is to allow reservation of the first bits while assinging the last bits. A signed 16bit integer, 2 bytes. An unsigned 16bit integer, 2 bytes. A signed 32bit integer, 4 bytes. An unsigned 32bit integer, 4 bytes. A fixed value (1) to indicate that the option is present, 0 bytes. A RFC 3397 encoded string. A RFC 1035 validated string. Binary data expressed as hexadecimal. Contains embedded options (implies encap as well). Contains encapsulated options (implies embed as well). References an option from the global definition.
Types to define
The type directly affects the length of data consumed inside the option. Any remaining data is normally discarded. Lengths can be specified for string and binhex types, but this is generally with other data embedded afterwards in the same option.
An IPv4 address, 4 bytes.
An IPv6 address, 16 bytes.
A NVT ASCII string of printable characters.
A byte represented as a string of flags, most significant bit first. For example, using ABCDEFGH then A would equal 10000000, B 01000000, C 00100000, etc. If the bit is not set, the flag is not printed. A flag of 0 is not printed even if the bit postition is set. This is to allow reservation of the first bits while assinging the last bits.
A signed 16bit integer, 2 bytes.
An unsigned 16bit integer, 2 bytes.
A signed 32bit integer, 4 bytes.
An unsigned 32bit integer, 4 bytes.
A fixed value (1) to indicate that the option is present, 0 bytes.
A RFC 3397 encoded string.
A RFC 1035 validated string.
Binary data expressed as hexadecimal.
Contains embedded options (implies encap as well).
Contains encapsulated options (implies embed as well).
References an option from the global definition.
# DHCP option 81, Fully Qualified Domain Name, RFC4702
define 81 embed fqdn
embed byte flags
embed byte rcode1
embed byte rcode2
embed domain fqdn
# DHCP option 125, Vendor Specific Information Option, RFC3925
define 125 encap vsio
embed uint32 enterprise_number
# Options defined for the enterprise number
encap 1 ipaddress ipaddress
Sends and expects the token with the secretid 0 and realm of "" in each message. Delayed Authentication. dhcpcd will send an authentication option with no key or MAC. The server will see this option, and select a key for dhcpcd.conf, writing the Same as above, but without a realm.
Supported Authentication Protocols
secretid in it. dhcpcd will then look for a non-expired token with a matching realm and secretid. This token is used to authenicate all other messages.
Sends and expects the token with the secretid 0 and realm of "" in each message.
Delayed Authentication. dhcpcd will send an authentication option with no key or MAC. The server will see this option, and select a key for dhcpcd.conf, writing the
Same as above, but without a realm.
If none specified,
Supported Authentication Algorithms
hmac-md5 is the default.
If none specified,
If none specified, Read the number in the file Create a NTP timestamp from the system time. Same as
Supported Replay Detection Mechanisms
monotonic is the default. If this is changed from what was previously used, or the means of calculating or storing it is broken then the DHCP server will probably have to have its notion of the clients Replay Detection Value reset.
/var/lib/dhcpcd/dhcpcd-rdm.monotonic and add one to it.
If none specified,
Read the number in the file
Create a NTP timestamp from the system time.
fnmatch(3), if_nametoindex(3), dhcpcd(8), dhcpcd-run-hooks(8)
Please report them to http://roy.marples.name/projects/dhcpcd