|DHCPCD(8)||System Manager's Manual||DHCPCD(8)|
dhcpcd — a DHCP
dhcpcd is an implementation of the DHCP
client specified in
dhcpcd 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.
dhcpcd then runs the configuration script which
writes DNS information to
resolvconf(8), if available,
otherwise directly to /etc/resolv.conf. 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
dhcpcd then 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.
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
dhcpcd is also an implementation of the
BOOTP client specified in
dhcpcd is also an implementation of the
IPv6 Router Solicitor as specified in
RFC 4861 and
dhcpcd is also an implementation of the
IPv6 Privacy Extensions to AutoConf as specified in
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.
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
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
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
If a single interface is given then
only works for that interface and runs as a separate instance to other
dhcpcd processes. The
--waitip option is enabled in this instance to
maintain compatibility with older versions. Using a single interface also
-x options, where the
same interface 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
--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.
/usr/libexec/dhcpcd-run-hooks, or the script
specified by the
--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,
30-hostname. You can disable each script by using
--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
dhcpcd can lookup the hostname of the IP
address in DNS if no hostname is given by the lease and one is not already
You can fine-tune the behaviour of
with the following options:
--duid[ll | lt | uuid | value]
--clientid. The DUID generated will be held in /var/db/dhcpcd/duid and should not be copied to other hosts. This file also takes precedence over the above rules except for setting a value.
dhcpcdcannot obtain a lease, then try to use the last lease acquired for the interface.
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.
dhcpcdwill re-apply IP address, routing and run dhcpcd-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 instruct
dhcpcdto put things back afterwards.
dhcpcddoes not read a new configuration when this happens - you should rebind if you need that functionality.
dhcpcditself never does any DNS updates.
dhcpcdencodes the FQDN hostname as specified in
dhcpcdalways processes the config file before any command line options.
dhcpcdsends a default clientid of the hardware family and the hardware address.
dhcpcdstill writes to syslog(3). The logfile is reopened when
dhcpcdprocess running on the interface to release its lease and de-configure the interface regardless of the
--persistentoption. If no interface is specified then this applies to all interfaces in Manager mode. If no interfaces are left running,
dhcpcddoes not request any lease time and leaves it in the hands of the DHCP server.
dhcpcdin Manager mode even if only one interface specified on the command line. See the Multiple Interfaces section above.
dhcpcdwill supply a default metric of 1000 + if_nametoindex(3). This will be offset by 2000 for wireless interfaces, with additional offsets of 1000000 for IPv4LL and 2000000 for roaming interfaces.
dhcpcdto reload its configuration and rebind the specified interface. If no interface is specified then this applies to all interfaces in Manager mode. If
dhcpcdis not running, then it starts up as normal.
dhcpcdto renew existing addresses on the specified interface. If no interface is specified then this applies to all interfaces in Manager mode. If
dhcpcdis not running, then it starts up as normal. Unlike the
--rebindoption above, the configuration for
dhcpcdis not reloaded.
dhcpcdde-configures the interface when it exits unless this option is enabled. 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.
--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 address in use. You should also include the optional cidr network 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. If
dhcpcdfails to contact a DHCP server then it returns a failure instead of falling back on IPv4LL.
dhcpcdis not processing IPv6RA messages and the need for DHCPv6 Information Request exists.
dhcpcdwill not attempt to obtain a lease and just use the value for the address with an infinite lease time.
Here is an example which configures a static address, routes and DNS.
You cannot presently set static DHCPv6 values. Use the
dhcpcdto wait forever to get a lease. If
dhcpcdis working on a single interface then
dhcpcdwill exit when a timeout occurs, otherwise
dhcpcdwill fork into the background.
Set the vendor option 01 with an IP address.
dhcpcdthen exits before doing any configuration.
--waitip=[4 | 6]
dhcpcdwill wait for any address protocol to be assigned. It is possible to wait for more than one address protocol and
dhcpcdwill only fork to the background when all waiting conditions are satisfied.
dhcpcdprocess running on the interface to exit. If no interface is specified, then the above is applied to all interfaces in Manager mode. See the
--persistentoption to control configuration persistence on exit, which is enabled by default in dhcpcd.conf(5).
dhcpcdthen waits until this process has exited.
dhcpcdto skip the reboot phase and go straight into discover. This has no effect on DHCPv6 other than skipping the reboot phase.
dhcpcd will try to do as much as it can by
default. However, there are sometimes situations where you don't want the
things to be configured exactly how the DHCP server wants. Here are some
options that deal with turning these bits off.
Note that when
dhcpcd is restricted to a
single interface then the interface also needs to be specified when asking
dhcpcd to exit using the commandline. If the
protocol is restricted as well then the protocol needs to be included with
the exit instruction.
--waitipoption to specify which protocol(s) to configure before exiting.
So to stop
dhcpcd from touching your
DNS settings you would do:-
dhcpcdwill set this automatically.
dhcpcdthrough a network manager.
dhcpcdwill use based on command-line arguments to stdout.
dhcpcdonly responds to DHCP servers and not BOOTP servers, you can
dhcpcdon the command line, only warnings and errors will be displayed. If this option is used another time then all console output is disabled. These messages are still logged via syslog(3).
-6flags to specify an address family. If a lease is piped in via standard input then that is dumped. In this case, specifying an address family is mandatory.
--blacklistis ignored if
--denyinterfacesthen it is still denied.
dhcpcdto be started in Manager mode and then wait for subsequent
dhcpcdcommands to start each interface as required.
dhcpcdto configure the system. This is the default behaviour and sets
dhcpcdwill not configure the system at all. This is only of use if the
dhcpcdcalls at each network event configures the system instead. This is different from
--testmode in that it's not one shot and the only change to the environment is the addition of
Some interfaces require configuration by 3rd parties, such as PPP
or VPN. When an interface configuration in
marked as STATIC or INFORM without an address then
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.
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.
dhcpcd to a single
interface and optionally 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 that
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
sends to match. If using a DUID in place of the ClientID, edit
--nohookoption described above.
dhcpcdrunning on all interfaces.
dhcpcdrunning on the interface.
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.
Roy Marples <email@example.com>
Please report them to https://roy.marples.name/projects/dhcpcd
|August 31, 2022||x86_64|