DHCPCD(8)
๐ฆ DHCPCD(8) โ a DHCP client ๐ฆ
from the System Manager's Manual, bestie
โจ NAME โจ
dhcpcd โ a DHCP client. That's the name, and it's iconic.
โจ SYNOPSIS โจ
okay so here's the whole shape of it, no cap:
dhcpcd [-146ABbDdEGgHJKLMNPpqTV] [-C, --nohook hook]
[-c, --script script] [-e, --env value] [-F, --fqdn FQDN]
[-f, --config file] [-h, --hostname hostname]
[-I, --clientid clientid] [-i, --vendorclassid vendorclassid]
[-j, --logfile logfile] [-l, --leasetime seconds]
[-m, --metric metric] [-O, --nooption option]
[-o, --option option] [-Q, --require option]
[-r, --request address] [-S, --static value]
[-s, --inform address[/cidr[/broadcast_address]]] [--inform6]
[-t, --timeout seconds] [-u, --userclass class]
[-v, --vendor code, value] [-W, --whitelist address[/cidr]] [-w]
[--waitip=[4 | 6]] [-y, --reboot seconds]
[-X, --blacklist address[/cidr]] [-Z, --denyinterfaces pattern]
[-z, --allowinterfaces pattern] [--inactive] [--configure]
[--noconfigure] [interface] [...]
dhcpcd -n, --rebind [interface]
dhcpcd -k, --release [interface]
dhcpcd -U, --dumplease [interface]
dhcpcd --version
dhcpcd -x, --exit [interface]
๐ธ DESCRIPTION ๐ธ
okay so listen: dhcpcd is an implementation of the DHCP client specified in RFC 2131. It gets the host information (IP address, routes, etc) from a DHCP server and configures the network interface of the machine on which it is running. Then it runs the configuration script which writes DNS information to resolvconf(8), if available, otherwise directly to /etc/resolv.conf. slay.
If the hostname is currently blank, (null) or localhost, or force_hostname is YES or TRUE or 1 then dhcpcd sets the hostname to the one supplied by the DHCP server. Then dhcpcd daemonises and waits for the lease renewal time to lapse. It will then attempt to renew its lease and reconfigure if the new lease changes when the lease begins to expire or the DHCP server sends a message to renew early. main character energy.
Bestie, if any interface reports a working carrier then dhcpcd will try to obtain a lease before forking to the background, otherwise it will fork right away. This behaviour can be modified with the -b, --background and -w, --waitip options.
dhcpcd is also an implementation of the BOOTP client specified in RFC 951.
dhcpcd is also an implementation of the IPv6 Router Solicitor as specified in RFC 4861 and RFC 6106.
dhcpcd is also an implementation of the IPv6 Privacy Extensions to AutoConf as specified in RFC 4941. This feature needs to be enabled in the kernel and dhcpcd will start using it.
dhcpcd is also an implementation of the DHCPv6 client as specified in RFC 3315. By default, dhcpcd only starts DHCPv6 when instructed to do so by an IPV6 Router Advertisement. If no Identity Association is configured, then a Non-temporary Address is requested.
๐ Local Link configuration ๐
If dhcpcd failed to obtain a lease, it probes for a valid IPv4LL address (aka ZeroConf, aka APIPA). Once obtained it restarts the process of looking for a DHCP server to get a proper address.
When using IPv4LL, dhcpcd nearly always succeeds and returns an exit code of 0. In the rare case it fails, it normally means that there is a reverse ARP proxy installed which always defeats IPv4LL probing. To disable this behaviour, you can use the -L, --noipv4ll option. iykyk.
๐ฆ Multiple interfaces ๐ฆ
If a list of interfaces are given on the command line, then dhcpcd only works with those interfaces, otherwise dhcpcd discovers available Ethernet interfaces that can be configured. When dhcpcd is not limited to one interface on the command line, it is running in Manager mode. The dhcpcd-ui project expects dhcpcd to be running this way.
If a single interface is given then dhcpcd only works for that interface and runs as a separate instance to other dhcpcd processes. The -w, --waitip option is enabled in this instance to maintain compatibility with older versions. Using a single interface, optionally further limited to an address protocol, also affects the -k, -N, -n and -x options, where the same interface and any address protocol will need to be specified, as a lack of an interface will imply Manager mode which this is not. To force starting in Manager mode with only one interface, the -M, --manager option can be used.
Interfaces are preferred by carrier, DHCP lease/IPv4LL and then lowest metric. For systems that support route metrics, each route will be tagged with the metric, otherwise dhcpcd changes the routes to use the interface with the same route and the lowest metric. See options below for controlling which interfaces we allow and deny through the use of patterns.
Non-ethernet interfaces and some virtual ethernet interfaces such as TAP and bridge are ignored by default, as is the FireWire interface. To work with these devices they either need to be specified on the command line, be listed in --allowinterfaces or have an interface directive in /etc/dhcpcd.conf.
๐ Hooking into events ๐
dhcpcd runs /usr/libexec/dhcpcd-run-hooks, or the script specified by the -c, --script option. This script runs each script found in /usr/libexec/dhcpcd-hooks in a lexical order. The default installation supplies the scripts 01-test, 20-resolv.conf and 30-hostname. You can disable each script by using the -C, --nohook option. See dhcpcd-run-hooks(8) for details on how these scripts work. dhcpcd currently ignores the exit code of the script.
More scripts are supplied in /usr/share/dhcpcd/hooks and need to be copied to /usr/libexec/dhcpcd-hooks if you intend to use them. For example, you could install 29-lookup-hostname so that dhcpcd can lookup the hostname of the IP address in DNS if no hostname is given by the lease and one is not already set.
โจ Fine tuning โจ
You can fine-tune the behaviour of dhcpcd with the following options:
-b,--backgroundโ Background immediately. This is useful for startup scripts which don't disable link messages for carrier status. ๐ซถ-c,--script scriptโ Use this script instead of the default/usr/libexec/dhcpcd-run-hooks.-D,--duid [ll | lt | uuid | value]โ Use a 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). The DUID type can be hinted as an optional parameter if the file/var/lib/dhcpcd/duiddoes not exist. If notll,ltoruuidthenvaluewill be converted from00:11:22:33format. This, plus the IAID will be used as the-I, --clientid. 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. ๐-d,--debugโ Echo debug messages to thestderrandsyslog.-E,--lastleaseโ Ifdhcpcdcannot obtain a lease, then try to use the last lease acquired for the interface.--lastleaseextendโ Same as the above, but the lease will be retained even if it expires.dhcpcdwill give it up if any other host tries to claim it for their own via ARP. This violates RFC 2131, section 3.7, which states the lease should be dropped once it has expired. ๐จ-e,--env valueโ Pushvalueto the environment for use indhcpcd-run-hooks(8). For example, you can force the hostname hook to always set the hostname with-e force_hostname=YES.-g,--reconfigureโdhcpcdwill re-apply IP address, routing and rundhcpcd-run-hooks(8)for each interface. This is useful so that a 3rd party such as PPP or VPN can change the routing table and / or DNS, etc and then instructdhcpcdto put things back afterwards.dhcpcddoes not read a new configuration when this happens - you should rebind if you need that functionality.-F,--fqdn fqdnโ Requests that the DHCP server update DNS using FQDN instead of just a hostname. Valid values forfqdnaredisable,none,ptrandboth.dhcpcditself never does any DNS updates.dhcpcdencodes the FQDN hostname as specified in RFC 1035.-f,--config fileโ Specify a config to load instead of/etc/dhcpcd.conf.dhcpcdalways processes the config file before any command line options.-h,--hostname hostnameโ Sendshostnameto the DHCP server so it can be registered in DNS. Ifhostnameis an empty string then the current system hostname is sent. Ifhostnameis a FQDN (i.e., contains a.) then it will be encoded as such.-I,--clientid clientidโ Send theclientid. If the string is of the format01:02:03then it is encoded as hex. For interfaces whose hardware address is longer than 8 bytes, or if theclientidis an empty string thendhcpcdsends a default clientid of the hardware family and the hardware address.-i,--vendorclassid vendorclassidโ Override the DHCPv4vendorclassidfield sent. The default isdhcpcd-<version>:<os>:<machine>:<platform>. For exampledhcpcd-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.-j,--logfile logfileโ Writes to the specifiedlogfile.dhcpcdstill writes tosyslog(3). Thelogfileis reopened whendhcpcdreceives theSIGUSR2signal.-k,--release [interface]โ This causes an existingdhcpcdprocess running on the interface to release its lease and de-configure the interface regardless of the-p, --persistentoption. If no interface is specified then this applies to all interfaces in Manager mode. If no interfaces are left running,dhcpcdwill exit.-l,--leasetime secondsโ Request a lease time ofseconds.-1represents an infinite lease time. By defaultdhcpcddoes not request any lease time and leaves it in the hands of the DHCP server.-M,--managerโ Startdhcpcdin Manager mode even if only one interface specified on the command line. See the Multiple Interfaces section above.-m,--metric metricโ Metrics are used to prefer an interface over another one, lowest wins.dhcpcdwill supply a default metric of1000 + if_nametoindex(3). This will be offset by2000for wireless interfaces, with additional offsets of1000000for IPv4LL and2000000for roaming interfaces.-n,--rebind[interface] โ tellsdhcpcdto reload its config and rebind the interface you named. No interface given? Then it's all interfaces, but only in Manager mode. And ifdhcpcdisn't even running, it just starts up like normal. no drama ๐-N,--renew[interface] โ same vibe, different errand: this one tellsdhcpcdto renew the addresses it already has on that interface. No interface = all interfaces in Manager mode. Not running at all? Starts up as usual. Big difference from-n,--rebindup there: the config fordhcpcdis not reloaded. keep that in mind bestie ๐-o,--optionoption โ asks for the DHCP option variable so it can be used in/usr/libexec/dhcpcd-run-hooks.-p,--persistentโ by defaultdhcpcdde-configures the interface when it exits, unless this is enabled. And honestly sometimes that default is just not it โ like if you've got root mounted over NFS, or SSH clients are connected to this host and they genuinely need to be notified that the host is shutting down. Use this option and that de-configuring stops happening. ๐ซถ-r,--requestaddress โ asks for that address in the DHCP DISCOVER message. Warning though: there is no guarantee this is the address the DHCP server will actually hand over ๐ญ. Leave the address out and the first address currently assigned to the interface gets used.-s,--informaddress[/cidr[/broadcast_address]] โ behaves like-r,--requestabove, except it sends a DHCP INFORM instead of DISCOVER/REQUEST. Heads up: this doesn't get a lease as such, it just notifies the DHCP server of the address in use. You should also include the optional cidr network number in case the address isn't already configured on the interface.dhcpcdstays running and pretends it has an infinite lease, and it will not de-configure the interface when it exits. And ifdhcpcdfails to contact a DHCP server? It returns a failure instead of falling back on IPv4LL. no fallback era ๐--inform6โ does a DHCPv6 Information Request. No address is requested or specified, but all the other DHCPv6 options are allowed. Normally this happens automatically when the IPv6 Router Advertises that the client should do this. You only need this option whendhcpcdisn't processing IPv6RA messages and the need for a DHCPv6 Information Request genuinely exists.-S,--staticvalue โ configures a static DHCP value. Setip_addressanddhcpcdwon't even try to obtain a lease โ it just uses that value for the address with an infinite lease time. slay โจ
Here's an example configuring a static address, routes and DNS:
dhcpcd -S ip_address=192.168.0.10/24 \
-S routers=192.168.0.1 \
-S domain_name_servers=192.168.0.1 \
eth0
You cannot presently set static DHCPv6 values ๐ use the -e, --env option instead.
-t,--timeoutseconds โ timeout after seconds instead of the default30. On timeout,dhcpcdexits if the-1,--oneshotoption was given โ otherwise it forks into the background and keeps on trying. Setting it to0seconds makesdhcpcdwait forever to get a lease. forever-forever. ๐ฐ๏ธ-u,--userclassclass โ tags the DHCPv4 message with the userclass class. DHCP servers use this to give members of the class DHCP options other than the default, without having to know things like hardware address or hostname. king behavior ๐-v,--vendorcode,value โ adds an encapsulated vendor option. code should be between1and254inclusive. To add a raw vendor string, omit code but keep the comma. Examples below ๐
Set the vendor option 01 with an IP address.
dhcpcd -v 01,192.168.0.2 eth0
Set the vendor option 02 with a hex code.
dhcpcd -v 02,01:02:03:04:05 eth0
Set the vendor option 03 with an IP address as a string.
dhcpcd -v 03,\"192.168.0.2\" eth0
Set un-encapsulated vendor option to hello world.
dhcpcd -v ,"hello world" eth0
--versionโ displays both program version and copyright information. Thendhcpcdexits before doing any configuration at all. just a lil peek, no commitment ๐-wโ waits for an address to be assigned before forking to the background. Does not take an argument, unlike the option right below it.--waitip=[4 | 6]โ waits for an address to be assigned before forking to the background.4means wait for an IPv4 address to be assigned.6means wait for an IPv6 address to be assigned. No argument given?dhcpcdwaits for any address protocol to be assigned. And yes, it's possible to wait for more than one address protocol โdhcpcdwill only fork to the background when all the waiting conditions are satisfied. patient queen ๐ธ-x,--exit[interface] โ signals an existingdhcpcdprocess running on the interface to exit. No interface specified? Then the above applies to all interfaces in Manager mode. Go peep the-p,--persistentoption to control configuration persistence on exit โ which is enabled by default indhcpcd.conf(5).dhcpcdthen waits until this process has exited.-y,--rebootseconds โ allows reboot seconds before moving to the discover phase if we have an old lease to use, and allows reboot seconds before starting fallback states from the discover phase. IPv4LL is started when the first reboot timeout is reached. Default is5seconds. A setting of0seconds causesdhcpcdto skip the reboot phase and go straight into discover. This has no effect on DHCPv6 other than skipping the reboot phase.
โจ Restricting behaviour โจ
dhcpcd will try to do as much as it can by default. Which is iconic of it honestly ๐ซถ but sometimes there are situations where you do not want things configured exactly how the DHCP server wants. So here are some options that deal with turning these bits off.
Note that whendhcpcdis restricted to a single interface, then the interface also needs to be specified when askingdhcpcdto exit using the commandline. And if the protocol is restricted as well, then the protocol needs to be included with the exit instruction. iykyk ๐
-1,--oneshotโ exit after configuring an interface. Use the-w,--waitipoption to specify which protocol(s) to configure before exiting. one and done ๐-4,--ipv4onlyโ configure IPv4 only.-6,--ipv6onlyโ configure IPv6 only.-A,--noarpโ don't request or claim the address by ARP. This also disables IPv4LL.-B,--nobackgroundโ don't run in the background when we acquire a lease. Mainly useful for running under the control of another process, such as a debugger or a network manager.-C,--nohookscript โ don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with.sh.
So to stop dhcpcd from touching your DNS settings you would do:
dhcpcd -C resolv.conf eth0
-G,--nogatewayโ don't set any default routes.-H,--xidhwaddrโ use the last four bytes of the hardware address as the DHCP xid instead of a randomly generated number.-J,--broadcastโ 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 instancesdhcpcdwill set this automatically. it's got you ๐-K,--nolinkโ don't receive link messages for carrier status. You should only have to use this with buggy device drivers or runningdhcpcdthrough a network manager. ๐-L,--noipv4llโ don't use IPv4LL (aka APIPA, aka Bonjour, aka ZeroConf). so many nicknames for one thing ๐ญ-O,--nooptionoption โ removes the option from the DHCP message before processing.-P,--printpidfileโ prints the pidfiledhcpcdwill use, based on command-line arguments, to stdout.-Q,--requireoption โ requires the option to be present in all DHCP messages, otherwise the message is ignored. To enforce thatdhcpcdonly responds to DHCP servers and not BOOTP servers, you can-Q dhcp_message_type.-q,--quietโ quietdhcpcdon the command line; only warnings and errors get displayed. Use this option another time and all console output is disabled. These messages are still logged viasyslog(3)though, so nothing's really lost.-T,--testโ on receipt of DHCP messages, just call/usr/libexec/dhcpcd-run-hookswith the reason ofTEST, which echos the DHCP variables found in the message to the console. The interface configuration isn't touched and neither are any configuration files. Therapid_commitoption is not sent inTESTmode so that the server does not lease an address. To test INFORM the interface needs to be configured with the desired address before startingdhcpcd. very look-don't-touch ๐-U,--dumplease[interface] โ dumps the current lease for the interface to stdout. No interface given? Then all interfaces are dumped. Use the-4or-6flags to specify an address family. If a lease is piped in via standard input, then use the special interface named-to dump it โ and in this case, specifying an address family is mandatory.-V,--variablesโ displays a list of option codes, the associated variable and encoding for use indhcpcd-run-hooks(8). Variables are prefixed withnew_andold_unless the option number is-. Variables without an option are part of the DHCP message and cannot be directly requested.-W,--whitelistaddress[/cidr] โ only accept packets from address[/cidr].-X,--blacklistis ignored if-W,--whitelistis set. whitelist supremacy โจ-X,--blacklistaddress[/cidr] โ ignore all packets from address[/cidr].-Z,--denyinterfacespattern โ when discovering interfaces, the interface name must not match pattern, which is a space or comma separated list of patterns passed tofnmatch(3).-z,--allowinterfacespattern โ when discovering interfaces, the interface name must match pattern, which is a space or comma separated list of patterns passed tofnmatch(3). But if the same interface is matched in-Z,--denyinterfaces, then it is still denied. denied is denied bestie ๐
Last four option besties, coming right up โ do not skip these, theyโre lowkey important:
--inactiveโ donโt start any interfaces other than the ones specified on the command line. This lets dhcpcd start in Manager mode and then wait for later dhcpcd commands to start each interface as required. ๐--configureโ lets dhcpcd configure the system; this is the default behaviour and setsif_configured=true. โจ--noconfigureโ dhcpcd will not configure the system at all. This is only useful if the--scriptthat dhcpcd calls at each network event configures the system instead. Itโs different from-T,--testmode because itโs not one shot, and the only change to the environment is the addition ofif_configured=false. ๐ซถ--nodevโ donโt load any/devmanagement modules. ๐
โจ 3RDPARTY LINK MANAGEMENT โจ
Some interfaces need a 3rd party to handle their config โ think PPP or VPN. When an interface configuration in dhcpcd is marked as STATIC or INFORM without an address, dhcpcd will monitor the interface until an address is added or removed from it and act accordingly. For point to point interfaces (like PPP), a default route to its destination is automatically added to the configuration. If the point to point interface is configured for INFORM, then dhcpcd unicasts INFORM to the destination; otherwise it defaults to STATIC. ๐ฆ
๐ NOTES ๐
dhcpcd requires a Berkeley Packet Filter, or BPF device on BSD based systems, and a Linux Socket Filter, or LPF device on Linux based systems, for all IPv4 configuration. No cap, thatโs just the vibe. โญ
If youโre restricting dhcpcd to a single interface and optionally an address family via the command-line, then all further calls to dhcpcd to rebind, reconfigure or exit need to include the same restrictive flags so dhcpcd knows which process to signal. ๐
Some DHCP servers implement ClientID filtering. If dhcpcd is replacing an in-use DHCP client, then you might need to adjust the clientid option dhcpcd sends to match. If using a DUID in place of the ClientID, edit /var/lib/dhcpcd/duid accordingly. ๐
๐ FILES ๐
/etc/dhcpcd.confโ configuration file for dhcpcd; if you always use the same options, put them here. ๐/usr/libexec/dhcpcd-run-hooksโ Bourne shell script that is run to configure or de-configure an interface./usr/lib64/dhcpcd/devโ Linux/devmanagement modules./usr/libexec/dhcpcd-hooksโ a directory containing Bourne shell scripts that are run by the above script. Each script can be disabled by using the-C,--nohookoption described above./var/lib/dhcpcd/duidโ text file that holds the DUID used to identify the host./var/lib/dhcpcd/secretโ text file that holds a secret key known only to the host. ๐คซ/var/lib/dhcpcd/interface-ssid.leaseโ the actual DHCP message sent by the server; we use this when reading the last lease and use the fileโs mtime as when it was issued./var/lib/dhcpcd/interface-ssid.lease6โ the actual DHCPv6 message sent by the server; we use this when reading the last lease and use the fileโs mtime as when it was issued./var/lib/dhcpcd/rdm_monotonicโ stores the monotonic counter used in the replay field in Authentication Options./run/dhcpcd/pidโ stores the PID of dhcpcd running on all interfaces./run/dhcpcd/interface.pidโ stores the PID of dhcpcd running on the interface./run/dhcpcd/sockโ control socket to the manager daemon./run/dhcpcd/interface.sockโ control socket to per interface daemon. ๐ง
๐ฆ SEE ALSO ๐ฆ
Go kiss these manual pages: fnmatch(3), if_nametoindex(3), dhcpcd.conf(5), resolv.conf(5), dhcpcd-run-hooks(8), resolvconf(8). ๐
๐ STANDARDS ๐
The standards squad is: RFC 951, RFC 1534, RFC 2104, RFC 2131, RFC 2132, RFC 2563, RFC 2855, RFC 3004, RFC 3118, RFC 3203, RFC 3315, RFC 3361, RFC 3633, RFC 3396, RFC 3397, RFC 3442, RFC 3495, RFC 3925, RFC 3927, RFC 4039, RFC 4075, RFC 4242, RFC 4361, RFC 4390, RFC 4702, RFC 4074, RFC 4861, RFC 4833, RFC 4941, RFC 5227, RFC 5942, RFC 5969, RFC 6106, RFC 6334, RFC 6355, RFC 6603, RFC 6704, RFC 7217, RFC 7550, RFC 7844. ๐ฅ
๐ AUTHORS ๐
Roy Marples <roy@marples.name> โ iconic. ๐
๐ BUGS ๐
Please report them to https://roy.marples.name/projects/dhcpcd. ๐
Source: Debian, date: July 5, 2026, manual: DHCPCD(8) โ and thatโs the whole page, bestie. Periodt. ๐ โจ
๐ฆ where this page comes from
- opensuse-leap 16.0: dhcpcd 10.5.2-160000.2.1 ยท BSD-2-Clause
- opensuse-leap 16.0: dhcpcd 10.5.2-160000.2.1 ยท BSD-2-Clause
- opensuse-leap 16.0: dhcpcd 10.5.2-160000.2.1 ยท BSD-2-Clause
- opensuse-leap 16.0: dhcpcd 10.5.2-160000.2.1 ยท BSD-2-Clause
- ๐ the page's license: BSD-2-Clause
- Copyright (c) 2006-2025 Roy Marples
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms