Scroll to navigation

DHCPCD.CONF(5) File Formats Manual DHCPCD.CONF(5)

NAME

dhcpcd.confdhcpcd configuration file

DESCRIPTION

Althoughdhcpcdcan do everything from the command line, there are cases where it's just easierto do it once in a configuration file.Most of the options found indhcpcd(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:

pattern
When discovering interfaces, the interface name must matchpatternwhich is a space or comma separated list of patterns passed tofnmatch(3).If the same interface is matched indenyinterfacesthen it is still denied.
pattern
When discovering interfaces, the interface name must not matchpatternwhich is a space or comma separated list of patterns passed tofnmatch(3).
Enables Anonymity Profiles for DHCP, RFC 7844.Any DUID is ignored and ClientID is set to LL only.All non essential options are then masked at this point,but they could be unmasked by explicitly requesting the optiontheanonymousoption is processed.As such, theanonymousoptionbe the last option in the configuration unless you really want tosend something which could identify you.dhcpcdwill not try and reboot an old lease, it will go straight intoDISCOVER/SOLICIT.
Forces a hardware address randomisation when the interface is brought upor when the carrier is lost.This is generally used in tandem with the anonymous option.
address[address]
dhcpcdwill arping each address in order before attempting DHCP.If an address is found, we will select the replying hardware address as theprofile, otherwise the IP address.Example:

interface bge0
arping 192.168.0.1

# My specific 192.168.0.1 network
profile dd:ee:aa:dd:bb:ee
static ip_address=192.168.0.10/24

# A generic 192.168.0.1 network
profile 192.168.0.1
static ip_address=192.168.0.98/24
protocol[algorithm[rdm]]
Authenticate DHCP messages.See the Supported Authentication Protocols section.Ifprotocolistokenthenalgorithmissnd_secretid/rcv_secretid so you can send and receive different tokens.
secretidrealmexpirekey
Define a shared key for use in authentication.realmcan be "" to for use with thedelayedprotocol.expireis the date the token expires and should be formatted "yyy-mm-dd HH:MM".You can use the keywordforeveror0which means the token never expires.For the token protocol,secretidneeds to be 0 andrealmneeds to be "".Ifdhcpcdhas the error
dhcp_auth_encode: Invalid argument
then it means thatdhcpcdcould not find the correct authentication token in your configuration.
Fork to the background immediately.This is useful for startup scripts which don't disable link messages forcarrier status.
address[/cidr]
Ignores all packets fromaddress[/cidr].
address[/cidr]
Only accept packets fromaddress[/cidr].blacklistis ignored ifwhitelistis set.
Be a BOOTP client.Basically, this just doesn't send a DHCP Message Type option and will onlyinteract 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,dhcpcdwill set this automatically.
group
Sets the group ownership of/run/dhcpcd/sockso that users other than root can connect todhcpcd.
Echo debug messages to the stderr and syslog.
value
Load thevalue/devmanagement module.dhcpcdwill load the first one found to work, if any.
value
Pushvalueto the environment for use indhcpcd-run-hooks(8).For example, you can force the hostname hook to always set the hostname withenvforce_hostname=YES.Or set which driverwpa_supplicant(8)should use withenvwpa_supplicant_driver=nl80211

If the hostname is set, it will be will set to the FQDN if possible as perRFC 4702, section 3.1.If the FQDN option is missing,dhcpcdwill still try and set a FQDN from the hostname and domain options forconsistency.To override this, setenvhostname_fqdn=[YES|NO|SERVER].A value ofSERVERmeans just what the server says, don't manipulate it.This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 networkwhere the DHCPv4 hostname is short and the DHCPv6 has an FQDN.DHCPv6 has no hostname option.

string
Send theclientid.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 theclientidis an empty string thendhcpcdsends a defaultclientidof the hardware family and the hardware address.
[ll|lt|uuid|value]
Use a DHCP Unique Identifier.If a system UUID is available, that will be used to create a DUID-UUID,otherwise if persistent storage is available then a DUID-LLT(link local address + time) is generated,otherwise DUID-LL is generated (link local address).The DUID type can be hinted as an optional parameter if the file/var/lib/dhcpcd/duiddoes not exist.If notll,ltoruuidthenvaluewill be converted from 00:11:22:33 format.This, plus the IAID will be used as theclientid.The DUID generated will be held in/var/lib/dhcpcd/duidand should not be copied to other hosts.This file also takes precedence over the above rules except for setting a value.
iaid
Set the Interface Association Identifier toiaid.This option must be used in aninterfaceblock.This defaults to the VLANID (prefixed with 0xff) for the interface if set,otherwise the last 4 bytes of the hardware address assigned to theinterface.Each instance of this should be unique within the scope of the client anddhcpcdwarns if a conflict is detected.If there is a conflict, it is only a problem if the conflicted IAIDs areused 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.
[address]
Request theaddressin the DHCP DISCOVER message.There is no guarantee this is the address the DHCP server will actually give.If noaddressis given then the first address currently assigned to theinterfaceis used.
[address[/cidr[/broadcast_address]]]
Behaves likerequestas above, but sends a DHCP INFORM instead of DISCOVER/REQUEST.This does not get a lease as such, just notifies the DHCP server of theaddressin use.You should also include the optionalcidrnetwork number in case the address is not already configured on the interface.dhcpcdremains running and pretends it has an infinite lease.dhcpcdwill not de-configure the interface when it exits.Ifdhcpcdfails to contact a DHCP server then it returns a failure instead of fallingback 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 an IPv6 Router Advertisementindicates that the client should perform this operation.This option is only needed whendhcpcdis not processing IPv6 RA messages and the need for a DHCPv6 Information Requestexists.
dhcpcdnormally de-configures the interface and configuration when it exits.Sometimes, this isn't desirable if, for example, you have root mounted overNFS or SSH clients connect to this host and they need to be notified ofthe host shutting down.You can use this option to stop this from happening.
profile
Fall back to using this profile if DHCP fails.This allows you to configure a static profile instead of using ZeroConf.
name
Sends the hostnamenameto the DHCP server so it can be registered in DNS.Ifnameis an empty string then the current system hostname is sent.Ifnameis a FQDN (i.e., 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 theirDNS if the domain part does not match theirs.

Also, see theenvoption above to control how the hostname is set on the host.

[iaid[/address]]
Request a DHCPv6 Normal Address foriaid.iaiddefaults to theiaidoption as described above.You can request more than one ia_na by specifying a uniqueiaidfor each one.
[iaid]
Request a DHCPv6 Temporary Address foriaid.You can request more than one ia_ta by specifying a uniqueiaidfor each one.
[iaid[/prefix/prefix_len][interface[/sla_id[/prefix_len[/suffix]]]]]
Request a DHCPv6 Delegated Prefix foriaid.This option must be used in aninterfaceblock.Unless asla_idof 0 is assigned with the same resultant prefix length as the delegation,a reject route is installed for the Delegated Prefix tostop unallocated addresses being resolved upstream.If nointerfaceis given then we will assign a prefix to every other interface with asla_idequivalent to the interface index assigned by the OS.Otherwise addresses are only assigned for eachinterfaceandsla_id.To avoid delegating to any interface, use - as the invalid interface name.Each assigned address will have asuffix,defaulting to 1.If thesuffixis 0 then a SLAAC address is assigned.You cannot assign a prefix to the requesting interface unless theDHCPv6 server supports theRFC 6603Prefix Exclude Option.dhcpcdhas to be running for all the interfaces it is delegating to.A defaultprefix_lenof 64 is assumed, unless the maximumsla_iddoes not fit.In this caseprefix_lenis increased to the highest multiple of 8 that can accommodate thesla_id.sla_idis an integer which must be unique inside theiaidand is added to the prefix which must fit insideprefix_lenless the length of the delegated prefix.You can specify multipleinterface/sla_id/prefix_lenperia_pd,space separated.IPv6RS should be disabled globally when requesting a Prefix Delegation.

In the following example eth0 is the externally facing interface to beconfigured 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 defaultroute and a /64 subnet to be delegated to the internal interface.The eth1 interface will be automatically configuredfor 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 automaticIPv6 address configuration for the internal network.

noipv6rs                 # disable routing solicitation
denyinterfaces eth2      # Don't touch eth2 at all
interface eth0
  ipv6rs                 # enable routing solicitation for eth0
  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
  ia_pd 4 -              # request a PD but don't assign it
Only configure IPv4.
Only configure IPv6.
[disable|none|ptr|both]
nonewill not ask the DHCP server to update DNS.ptrjust asks the DHCP server to update the PTRrecord of the host in DNS, whereasbothalso updates the A record.disablewill disable the FQDN option.The default isboth.dhcpcditself never does any DNS updates.dhcpcdencodes the FQDN hostname as specified inRFC 1035.
interface
Subsequent options are only parsed for thisinterface.
Generate SLAAC addresses for each Prefix advertised by an IPv6Router Advertisement message with the Auto flag set.On by default.
Disables the above option.
By default, whendhcpcdreceives an IPv6 Router Advertisement,dhcpcdwill only fork to the background if the RA contains at least one unexpiredRDNSS option and a valid prefix or no DHCPv6 instruction.Set this option so to makedhcpcdalways fork on a RA.
Enables IPv6 Router Advertisement solicitation.This is on by default, but is documented here in the case where it is disabledglobally but needs to be enabled for one interface.
seconds
Request DHCP a lease time ofseconds.-1represents an infinite lease time.By defaultdhcpcddoes not request any lease time and leaves it in the hands of theDHCP server.It is not possible to request a DHCPv6 lease time as this is not RFC compliant.See RFC 8415 21.4, 21.6, 21.21 and 21.22.
Override the size of the link receive buffer from the kernel default.Whiledhcpcdwill recover from link buffer overflows,this may not be desirable on heavily loaded systems.
logfile
Writes to the specifiedlogfile.dhcpcdstill writes tosyslog(3).Thelogfileis reopened whendhcpcdreceives theSIGUSR2signal.
metric
Metrics are used to prefer an interface over another one, lowest wins.dhcpcdwill supply a default metric of 1000 +if_nametoindex(3).This will be offset by 2000 for wireless interfaces, with additional offsetsof 1000000 for IPv4LL and 2000000 for roaming interfaces.
url
Specifies the URL for a Manufacturer Usage Description (MUD).The description is used by upstream network devices to instantiate anydesired access lists.See draft-ietf-opsawg-mud for more information.
Any pre-existing IPv4 addresses will be removed from the interface whenadding 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 load/devmanagement modules.
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 an IPv6 Router Advertisement instruction orconfiguration.
Don't install any default routes.
Install a default route if available (default).
script
Don't run this hook script.Matches full name, or prefixed with 2 numbers optionally ending with.sh.

So to stopdhcpcdfrom 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.SeeRFC 3927.
Don't solicit or accept IPv6 Router Advertisements and DHCPv6.
Don't solicit or accept 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 manager mode.
option
Requests theoptionfrom the server.It can be a variable to be used indhcpcd-run-hooks(8)or the numerical value.You can specify moreoptionsseparated by commas, spaces or moreoptionlines.Prepend dhcp6_ tooptionto request a DHCPv6 option.If no DHCPv6 options are configured,then DHCPv4 options are mapped to equivalent DHCPv6 options.

Prepend nd_ tooptionto handle ND options, but this only works for thenooption,rejectandrequireoptions.

To see a list of options you can use, calldhcpcdwith the-V,--variablesargument.

option
Remove the option from the message before it's processed.
option
Requires theoptionto be present in all messages, otherwise the message is ignored.To enforce thatdhcpcdonly responds to DHCP servers and not BOOTP servers, you canrequiredhcp_message_type.This isn't an exact science though because a BOOTP server can send DHCP-likeoptions.
option
Reject a message that contains theoption.This is useful when you cannot userequireto select / de-select BOOTP messages.
option
Ifdhcpcd.confdetects an address added to a point to point interface (PPP, TUN, etc) thenit will set the listed DHCP options to the destination address of theinterface.
name
Subsequent options are only parsed for this profilename.
Suppress any dhcpcd output to the console, except for errors.
seconds
Allowrebootseconds before moving to the DISCOVER phase if we have an old lease to use.Allowrebootseconds before starting fallback states from the DISCOVER phase.IPv4LL is started when the firstreboottimeout is reached.The default is 5 seconds.A setting of 0 seconds causesdhcpcd.confto skip the reboot phase and go straight into DISCOVER.This is desirable for mobile users because if you change from network A tonetwork B and they use the same subnet and the address from network A isn'tin use on network B, then the DHCP server will remain silent even ifauthoritative which meansdhcpcdwill timeout before moving back to the DISCOVER phase.This has no effect on DHCPv6 other than skipping the reboot phase.
dhcpcdwill release the lease prior to stopping the interface.
script
Usescriptinstead of the default/usr/lib/dhcpcd/dhcpcd-run-hooks.
ssid
Subsequent options are only parsed for this wirelessssid.
hwaddr||token[temp|temporary]
Selects the interface identifier used for SLAAC generated IPv6 addresses.Ifprivateis used, a RFC 7217 address is generated.Iftokentokenis used then the token is combined with the prefix to make the final address.Thetemporarydirective will create a temporary address for the prefix as well.
value
Configures a staticvalue.If you setip_addressthendhcpcdwill not attempt to obtain a lease and will just use the value for the addresswith an infinite lease time.If you set an empty value this removes all prior static allocations tothe same value.This is useful when using profiles and in the case ofip_addressit will remove the static allocation.Note that setting 0.0.0.0 keeps the static allocation but waits for a 3rdpartyto configure the address.If you setip6_address,dhcpcdwill continue auto-configuration as normal.

Here is an example which configures two static address, overriding the defaultIPv4 broadcast address, an IPv4 router, DNS and disables IPv6 auto-configuration.You could also use theinform6command here if you wished to obtain more information via DHCPv6.For IPv4, you should use theinformipaddressoption instead of setting a static address.

interface eth0
noipv6rs
static ip_address=192.168.0.10/24
static broadcast_address=192.168.0.63
static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.0.1
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 specialdestinationkeyword to insert the destination addressinto the value.

interface ppp0
static ip_address=0.0.0.0
destination routers
seconds
Time out afterseconds,instead of the default 30.A setting of 0secondscausesdhcpcdto wait forever to get a lease.Ifdhcpcdis working on a single interface thendhcpcdwill exit when a timeout occurs, otherwisedhcpcdwill fork into the background.If using IPv4LL thendhcpcdstart the IPv4LL process after the timeout and then wait a little longerbefore really timing out.
string
Tag the DHCPv4 message with the userclass.You can specify more than one.
string
Tag the DHCPv4 mesasge with the Microsoft userclass.Unlike theuserclassoption, this one can only be added once.It should only be used for Microsoft DHCP servers and thevendorclassidshould be set to "MSFT 98" or "MSFT 5.0".This option is not RFC compliant.
code,value
Add an encapsulated vendor option.codeshould be between 1 and 254 inclusive.To add a raw vendor string, omitcodebut keep the comma.Examples.

Set the vendor option 01 with an IP address.

vendor 01,192.168.0.2
Set the vendor option 02 with a hex code.
vendor 02,01:02:03:04:05
Set 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"
string
Set the DHCP Vendor Class.DHCPv6 has its own option as shown below.The default isdhcpcd-<version>:<os>:<machine>:<platform>.For example
dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386
If 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.
endata
Add the DHCPv6 Vendor Indetifying Vendor Class with the IANA assigned EnterpriseNumberenwith thedata.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.
[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.confwill wait for any address protocol to be assigned.It is possible to wait for more than one address protocol anddhcpcd.confwill only fork to the background when all waiting conditions are satisfied.
Use the last four bytes of the hardware address as the DHCP xid insteadof a randomly generated number.

Defining new options

DHCP, ND and DHCPv6 allow for the use of custom options, and RFC 3925 vendoroptions for DHCP can also be supplied.Each option needs to be started with thedefine,definend,define6orvendoptdirective.This can optionally be followed by bothembedorencapoptions.Both can be specified more than once andembedmust come beforeencap.

codetypevariable
Defines the DHCP optioncodeoftypewith a name ofvariableexported todhcpcd-run-hooks(8).
codetypevariable
Defines the ND optioncodeoftypewith a name ofvariableexported todhcpcd-run-hooks(8),with a prefix ofnd_.
codetypevariable
Defines the DHCPv6 optioncodeoftypewith a name ofvariableexported todhcpcd-run-hooks(8),with a prefix ofdhcp6_.
codetypevariable
Defines the Vendor-Identifying Vendor Options.Thecodeis the IANA Enterprise Number which will uniquely describe the encapsulatedoptions.typeis normallyencap.variablenames the Vendor option to be exported.
typevariable
Defines an embedded variable within the defined option.The length is determined by thetype.If thevariableis not the same as defined in the parent option,it is prefixed with the parentvariablefirst with an underscore.If thevariablehas the name ofreservedthen it is not processed.
codetypevariable
Defines an encapsulated variable within the defined option.The length is determined by thetype.If thevariableis not the same as defined in the parent option,it is prefixed with the parentvariablefirst with an underscore.

Type prefix

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 userconfiguration.
This option cannot be requested, regardless of user configuration.
This option is optional.Only makes sense for embedded options like the client FQDN option, wherethe 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 beingthe same type.

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 generallywith other data embedded afterwards in the same option.

An IPv4 address, 4 bytes.
An IPv6 address, 16 bytes.
[:length]
A NVT ASCII string of printable characters.
A byte.
:flags
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 position is set.This is to allow reservation of the first bits while assigning 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.
An RFC 3397 encoded string.
An RFC 1035 validated string.
If an array then the first two bytes are the URI length inside the option data.Otherwise, the whole option data is the URI.As a space is not allowed in the URI encoding, the URIs are space separated.
[:length]
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.

Example definition

# DHCP option 81, Fully Qualified Domain Name, RFC 4702
define 81 embed fqdn
embed byte flags
embed byte rcode1
embed byte rcode2
embed domain fqdn

# DHCP option 125, Vendor Specific Information Option, RFC 3925
define 125 encap vsio
embed uint32 enterprise_number
# Options defined for the enterprise number
encap 1 ipaddress ipaddress

Supported Authentication Protocols

Sends a plain text token the server expects and matches a token sent bythe server.The tokens do not have to be the same.If unspecified, the token with asecretidof 0 will be used in sending messagesand validating received messages.
Delayed Authentication.dhcpcdwill send an authentication option with no key or MAC.The server will see this option, and select a key fordhcpcd.conf,writingtherealmandsecretidin it.dhcpcdwill then look for an unexpired token with a matchingrealmandsecretid.This token is used to authenticate all other messages.
Same as above, but without a realm.

Supported Authentication Algorithms

If none specified,hmac-md5is the default.

 

Supported Replay Detection Mechanisms

If none specified,monotonicis the default.If this is changed from what was previously used,or the means of calculating or storing it is broken, then the DHCP serverwill probably have to have its notion of the client's Replay Detection Valuereset.

Read the number in the file/var/lib/dhcpcd/dhcpcd-rdm.monotonicand add one to it.
Create an NTP timestamp from the system time.
Same asmonotime.

SEE ALSO

fnmatch(3),if_nametoindex(3),dhcpcd(8),dhcpcd-run-hooks(8)

AUTHORS

Roy Marples<roy@marples.name>

BUGS

Please report them tohttps://roy.marples.name/projects/dhcpcd

December 18, 2023 Debian