| DHCPCD(8) | System Manager's Manual | DHCPCD(8) |
dhcpcd —
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] [interface]
[...] |
dhcpcd |
-n,
--rebind [interface] |
dhcpcd |
-k,
--release [interface] |
dhcpcd |
-U,
--dumplease
interface |
dhcpcd |
--version |
dhcpcd |
-x,
--exit [interface] |
dhcpcd is an implementation of the DHCP client specified
in RFC 2131. 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
DHCP server. 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 and 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.
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.
dhcpcd only works with those interfaces, otherwise
dhcpcd discovers available Ethernet interfaces that
can be configured. When dhcpcd not limited to one
interface on the command line, it is running in Master 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. -w,
--waitip option is enabled
in this instance to maintain compatibility with older versions. Using a
single interface also affects the -k,
-N, -n and
-x options, where the same interface will need to be
specified, as a lack of an interface will imply Master mode which this is
not. To force starting in Master mode with only one interface, the
-M,
--master 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.
dhcpcd runs
/libexec/dhcpcd-run-hooks, or the script specified by
the -c,
--script option. This script
runs each script found in /libexec/dhcpcd-hooks in a
lexical order. The default installation supplies the scripts
01-test, 02-dump,
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/examples/dhcpcd/hooks and need to be
copied to /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.
dhcpcd with the
following options:
-b,
--background-c,
--script
script-D,
--duid-I,
--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.-d,
--debug-E,
--lastleasedhcpcd cannot obtain a lease, then try to use
the last lease acquired for the interface.--lastleaseextenddhcpcd will 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-e
force_hostname=YES.-g,
--reconfiguredhcpcd will 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
dhcpcd to put things back afterwards.
dhcpcd does not read a new configuration when this
happens - you should rebind if you need that functionality.-F,
--fqdn
fqdndhcpcd itself never does any DNS
updates. dhcpcd encodes the FQDN hostname as
specified in RFC 1035.-f,
--config
filedhcpcd
always processes the config file before any command line options.-h,
--hostname
hostname-I,
--clientid
clientiddhcpcd sends a default
clientid of the hardware family and the hardware
address.-i,
--vendorclassid
vendorclassid-j,
--logfile
logfiledhcpcd receives the
SIGUSR2 signal.-k,
--release
[interface]dhcpcd process running on
the interface to release its lease and de-configure
the interface regardless of the
-p,
--persistent option. If no
interface is specified then this applies to all
interfaces in Master mode. If no interfaces are left running,
dhcpcd will exit.-l,
--leasetime
secondsdhcpcd does not request any lease time and leaves
it in the hands of the DHCP server.-M,
--masterdhcpcd in Master mode even if only one
interface specified on the command line. See the Multiple Interfaces
section above.-m,
--metric
metricdhcpcd will supply a default metic of 200 +
if_nametoindex(3).
An extra 100 will be added for wireless interfaces.-n,
--rebind
[interface]dhcpcd to reload its configuration and
rebind the specified interface. If no
interface is specified then this applies to all
interfaces in Master mode. If dhcpcd is not
running, then it starts up as normal.-N,
--renew
[interface]dhcpcd to renew existing addresses on the
specified interface. If no
interface is specified then this applies to all
interfaces in Master mode. If dhcpcd is not
running, then it starts up as normal. Unlike the
-n,
--rebind option above, the
configuration for dhcpcd is not reloaded.-o,
--option
option-p,
--persistentdhcpcd 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.-r,
--request
address-s,
--inform
address[/cidr[/broadcast_address]]-r,
--request as 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. 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.--inform6dhcpcd is not processing IPv6RA messages and the
need for DHCPv6 Information Request exists.-S,
--static
valueip_address then dhcpcd
will 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
-e,
--env option
instead.
-t,
--timeout
secondsdhcpcd 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.-u,
--userclass
class-v,
--vendor
code,valueSet the vendor option 01 with an IP address.
--versiondhcpcd then exits before doing any
configuration.-w--waitip=[4 | 6]dhcpcd will wait for any address protocol to be
assigned. It is possible to wait for more than one address protocol and
dhcpcd will only fork to the background when all
waiting conditions are satisfied.-x,
--exit
[interface]dhcpcd process
running on the interface to exit. If no
interface is specified, then the above is applied to
all interfaces in Master mode. See the -p,
--persistent option to
control configuration persistence on exit, which is enabled by default in
dhcpcd.conf(5).
dhcpcd then waits until this process has
exited.-y,
--reboot
secondsdhcpcd to 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.
-1,
--oneshot-w,
--waitip option to specify
which protocol(s) to configure before exiting.-4,
--ipv4only-6,
--ipv6only-A,
--noarp-B,
--nobackground-C,
--nohook
scriptSo to stop dhcpcd from touching your
DNS settings you would do:-
-G,
--nogateway-H,
--xidhwaddr-J,
--broadcastdhcpcd will set
this automatically.-K,
--nolinkdhcpcd through a network manager.-L,
--noipv4ll-O,
--nooption
option-P,
--printpidfiledhcpcd
will use based on commmand-line arguments to stdout.-Q,
--require
optiondhcpcd only responds to DHCP servers and not BOOTP
servers, you can -Q
dhcp_message_type.-q,
--quietdhcpcd on the command line, only warnings
and errors will be displayed. The messages are still logged though.-T,
--testdhcpcd.-U,
--dumplease
interface-4 or -6 flags to
specify an address family.-V,
--variables-W,
--whitelist
address[/cidr]-X,
--blacklist is ignored if
-W,
--whitelist is set.-X,
--blacklist
address[/cidr]-Z,
--denyinterfaces
pattern-z,
--allowinterfaces
pattern-Z,
- -denyinterfaces then it
is still denied.--inactivedhcpcd to be started in Master mode
and then wait for subsequent dhcpcd commands to
start each interface as required.--nodevdhcpcd is 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 Berkley 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.
If restricting 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 dhcpcd
sends to match. If using a DUID in place of the ClientID, edit
/var/db/dhcpcd/duid accordingly.
-C,
--nohook option described
above.dhcpcd running on all
interfaces.dhcpcd running on the
interface.| October 9, 2019 | NetBSD 9.3 |