xref: /netbsd-src/external/bsd/dhcpcd/dist/src/dhcpcd.8 (revision c9f4661bc030557c427a5a8ac2613e5d1b62dbb5)
12364920bSroy.\" SPDX-License-Identifier: BSD-2-Clause
22364920bSroy.\"
3794dfa77Sroy.\" Copyright (c) 2006-2023 Roy Marples
42364920bSroy.\" All rights reserved
52364920bSroy.\"
62364920bSroy.\" Redistribution and use in source and binary forms, with or without
72364920bSroy.\" modification, are permitted provided that the following conditions
82364920bSroy.\" are met:
92364920bSroy.\" 1. Redistributions of source code must retain the above copyright
102364920bSroy.\"    notice, this list of conditions and the following disclaimer.
112364920bSroy.\" 2. Redistributions in binary form must reproduce the above copyright
122364920bSroy.\"    notice, this list of conditions and the following disclaimer in the
132364920bSroy.\"    documentation and/or other materials provided with the distribution.
142364920bSroy.\"
152364920bSroy.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
162364920bSroy.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
172364920bSroy.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
182364920bSroy.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
192364920bSroy.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
202364920bSroy.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
212364920bSroy.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
222364920bSroy.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
232364920bSroy.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
242364920bSroy.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
252364920bSroy.\" SUCH DAMAGE.
262364920bSroy.\"
27*c9f4661bSroy.Dd December 10, 2023
282364920bSroy.Dt DHCPCD 8
292364920bSroy.Os
302364920bSroy.Sh NAME
312364920bSroy.Nm dhcpcd
322364920bSroy.Nd a DHCP client
332364920bSroy.Sh SYNOPSIS
342364920bSroy.Nm
352364920bSroy.Op Fl 146ABbDdEGgHJKLMNPpqTV
362364920bSroy.Op Fl C , Fl Fl nohook Ar hook
372364920bSroy.Op Fl c , Fl Fl script Ar script
382364920bSroy.Op Fl e , Fl Fl env Ar value
392364920bSroy.Op Fl F , Fl Fl fqdn Ar FQDN
402364920bSroy.Op Fl f , Fl Fl config Ar file
412364920bSroy.Op Fl h , Fl Fl hostname Ar hostname
422364920bSroy.Op Fl I , Fl Fl clientid Ar clientid
432364920bSroy.Op Fl i , Fl Fl vendorclassid Ar vendorclassid
442364920bSroy.Op Fl j , Fl Fl logfile Ar logfile
452364920bSroy.Op Fl l , Fl Fl leasetime Ar seconds
462364920bSroy.Op Fl m , Fl Fl metric Ar metric
472364920bSroy.Op Fl O , Fl Fl nooption Ar option
482364920bSroy.Op Fl o , Fl Fl option Ar option
492364920bSroy.Op Fl Q , Fl Fl require Ar option
502364920bSroy.Op Fl r , Fl Fl request Ar address
512364920bSroy.Op Fl S , Fl Fl static Ar value
522364920bSroy.Op Fl s , Fl Fl inform Ar address Ns Op Ar /cidr Ns Op Ar /broadcast_address
532364920bSroy.Op Fl Fl inform6
542364920bSroy.Op Fl t , Fl Fl timeout Ar seconds
552364920bSroy.Op Fl u , Fl Fl userclass Ar class
562364920bSroy.Op Fl v , Fl Fl vendor Ar code , Ar value
572364920bSroy.Op Fl W , Fl Fl whitelist Ar address Ns Op Ar /cidr
582364920bSroy.Op Fl w
592364920bSroy.Op Fl Fl waitip Ns = Ns Op 4 | 6
602364920bSroy.Op Fl y , Fl Fl reboot Ar seconds
612364920bSroy.Op Fl X , Fl Fl blacklist Ar address Ns Op Ar /cidr
622364920bSroy.Op Fl Z , Fl Fl denyinterfaces Ar pattern
632364920bSroy.Op Fl z , Fl Fl allowinterfaces Ar pattern
642364920bSroy.Op Fl Fl inactive
652364920bSroy.Op Fl Fl configure
662364920bSroy.Op Fl Fl noconfigure
672364920bSroy.Op interface
682364920bSroy.Op ...
692364920bSroy.Nm
702364920bSroy.Fl n , Fl Fl rebind
712364920bSroy.Op interface
722364920bSroy.Nm
732364920bSroy.Fl k , Fl Fl release
742364920bSroy.Op interface
752364920bSroy.Nm
762364920bSroy.Fl U , Fl Fl dumplease
772364920bSroy.Op Ar interface
782364920bSroy.Nm
792364920bSroy.Fl Fl version
802364920bSroy.Nm
812364920bSroy.Fl x , Fl Fl exit
822364920bSroy.Op interface
832364920bSroy.Sh DESCRIPTION
842364920bSroy.Nm
852364920bSroyis an implementation of the DHCP client specified in
862364920bSroy.Li RFC 2131 .
872364920bSroy.Nm
882364920bSroygets the host information
892364920bSroy.Po
902364920bSroyIP address, routes, etc
912364920bSroy.Pc
922364920bSroyfrom a DHCP server and configures the network
932364920bSroy.Ar interface
942364920bSroyof the
952364920bSroymachine on which it is running.
962364920bSroy.Nm
972364920bSroythen runs the configuration script which writes DNS information to
982364920bSroy.Xr resolvconf 8 ,
992364920bSroyif available, otherwise directly to
1002364920bSroy.Pa /etc/resolv.conf .
1012364920bSroyIf the hostname is currently blank, (null) or localhost, or
1022364920bSroy.Va force_hostname
1032364920bSroyis YES or TRUE or 1 then
1042364920bSroy.Nm
1052364920bSroysets the hostname to the one supplied by the DHCP server.
1062364920bSroy.Nm
1072364920bSroythen daemonises and waits for the lease renewal time to lapse.
1082364920bSroyIt will then attempt to renew its lease and reconfigure if the new lease
1092364920bSroychanges when the lease begins to expire or the DHCP server sends a message
1102364920bSroyto renew early.
1112364920bSroy.Pp
1122364920bSroyIf any interface reports a working carrier then
1132364920bSroy.Nm
1142364920bSroywill try to obtain a lease before forking to the background,
1152364920bSroyotherwise it will fork right away.
1162364920bSroyThis behaviour can be modified with the
1172364920bSroy.Fl b , Fl Fl background
1182364920bSroyand
1192364920bSroy.Fl w , Fl Fl waitip
1202364920bSroyoptions.
1212364920bSroy.Pp
1222364920bSroy.Nm
1232364920bSroyis also an implementation of the BOOTP client specified in
1242364920bSroy.Li RFC 951 .
1252364920bSroy.Pp
1262364920bSroy.Nm
1272364920bSroyis also an implementation of the IPv6 Router Solicitor as specified in
1282364920bSroy.Li RFC 4861
1292364920bSroyand
1302364920bSroy.Li RFC 6106 .
1312364920bSroy.Pp
1322364920bSroy.Nm
1332364920bSroyis also an implementation of the IPv6 Privacy Extensions to AutoConf as
1342364920bSroyspecified in
1352364920bSroy.Li RFC 4941 .
1362364920bSroyThis feature needs to be enabled in the kernel and
1372364920bSroy.Nm
1382364920bSroywill start using it.
1392364920bSroy.Pp
1402364920bSroy.Nm
1412364920bSroyis also an implementation of the DHCPv6 client as specified in
1422364920bSroy.Li RFC 3315 .
1432364920bSroyBy default,
1442364920bSroy.Nm
1452364920bSroyonly starts DHCPv6 when instructed to do so by an IPV6 Router Advertisement.
1462364920bSroyIf no Identity Association is configured,
1472364920bSroythen a Non-temporary Address is requested.
1482364920bSroy.Ss Local Link configuration
1492364920bSroyIf
1502364920bSroy.Nm
1512364920bSroyfailed to obtain a lease, it probes for a valid IPv4LL address
1522364920bSroy.Po
1532364920bSroyaka ZeroConf, aka APIPA
1542364920bSroy.Pc .
1552364920bSroyOnce obtained it restarts the process of looking for a DHCP server to get a
1562364920bSroyproper address.
1572364920bSroy.Pp
1582364920bSroyWhen using IPv4LL,
1592364920bSroy.Nm
1602364920bSroynearly always succeeds and returns an exit code of 0.
1612364920bSroyIn the rare case it fails, it normally means that there is a reverse ARP proxy
1622364920bSroyinstalled which always defeats IPv4LL probing.
1632364920bSroyTo disable this behaviour, you can use the
1642364920bSroy.Fl L , Fl Fl noipv4ll
1652364920bSroyoption.
1662364920bSroy.Ss Multiple interfaces
1672364920bSroyIf a list of interfaces are given on the command line, then
1682364920bSroy.Nm
1692364920bSroyonly works with those interfaces, otherwise
1702364920bSroy.Nm
1712364920bSroydiscovers available Ethernet interfaces that can be configured.
1722364920bSroyWhen
1732364920bSroy.Nm
174794dfa77Sroyis not limited to one interface on the command line,
1752364920bSroyit is running in Manager mode.
1762364920bSroyThe
1772364920bSroy.Nm dhcpcd-ui
1782364920bSroyproject expects dhcpcd to be running this way.
1792364920bSroy.Pp
1802364920bSroyIf a single interface is given then
1812364920bSroy.Nm
1822364920bSroyonly works for that interface and runs as a separate instance to other
1832364920bSroy.Nm
1842364920bSroyprocesses.
185794dfa77SroyThe
1862364920bSroy.Fl w , Fl Fl waitip
1872364920bSroyoption is enabled in this instance to maintain compatibility with older
1882364920bSroyversions.
189*c9f4661bSroyUsing a single interface,
190*c9f4661bSroyoptionally further limited to an address protocol,
191*c9f4661bSroyalso affects the
1922364920bSroy.Fl k ,
1932364920bSroy.Fl N ,
1942364920bSroy.Fl n
1952364920bSroyand
1962364920bSroy.Fl x
197*c9f4661bSroyoptions, where the same interface and any address protocol
198*c9f4661bSroywill need to be specified, as a lack of an
1992364920bSroyinterface will imply Manager mode which this is not.
2002364920bSroyTo force starting in Manager mode with only one interface, the
2012364920bSroy.Fl M , Fl Fl manager
2022364920bSroyoption can be used.
2032364920bSroy.Pp
2042364920bSroyInterfaces are preferred by carrier, DHCP lease/IPv4LL and then lowest metric.
2052364920bSroyFor systems that support route metrics, each route will be tagged with the
2062364920bSroymetric, otherwise
2072364920bSroy.Nm
2082364920bSroychanges the routes to use the interface with the same route and the lowest
2092364920bSroymetric.
2102364920bSroySee options below for controlling which interfaces we allow and deny through
2112364920bSroythe use of patterns.
2122364920bSroy.Pp
2132364920bSroyNon-ethernet interfaces and some virtual ethernet interfaces
2142364920bSroysuch as TAP and bridge are ignored by default,
2152364920bSroyas is the FireWire interface.
2162364920bSroyTo work with these devices they either need to be specified on the command line,
2172364920bSroybe listed in
2182364920bSroy.Fl Fl allowinterfaces
2192364920bSroyor have an interface directive in
2202364920bSroy.Pa /etc/dhcpcd.conf .
2212364920bSroy.Ss Hooking into events
2222364920bSroy.Nm
2232364920bSroyruns
2242364920bSroy.Pa /libexec/dhcpcd-run-hooks ,
2252364920bSroyor the script specified by the
2262364920bSroy.Fl c , Fl Fl script
2272364920bSroyoption.
2282364920bSroyThis script runs each script found in
2292364920bSroy.Pa /libexec/dhcpcd-hooks
2302364920bSroyin a lexical order.
2312364920bSroyThe default installation supplies the scripts
2322364920bSroy.Pa 01-test ,
2332364920bSroy.Pa 20-resolv.conf
2342364920bSroyand
2352364920bSroy.Pa 30-hostname .
2362364920bSroyYou can disable each script by using the
2372364920bSroy.Fl C , Fl Fl nohook
2382364920bSroyoption.
2392364920bSroySee
2402364920bSroy.Xr dhcpcd-run-hooks 8
2412364920bSroyfor details on how these scripts work.
2422364920bSroy.Nm
2432364920bSroycurrently ignores the exit code of the script.
2442364920bSroy.Pp
2452364920bSroyMore scripts are supplied in
2462364920bSroy.Pa /usr/share/dhcpcd/hooks
2472364920bSroyand need to be copied to
2482364920bSroy.Pa /libexec/dhcpcd-hooks
2492364920bSroyif you intend to use them.
2502364920bSroyFor example, you could install
2512364920bSroy.Pa 29-lookup-hostname
2522364920bSroyso that
2532364920bSroy.Nm
2542364920bSroycan lookup the hostname of the IP address in DNS if no hostname
2552364920bSroyis given by the lease and one is not already set.
2562364920bSroy.Ss Fine tuning
2572364920bSroyYou can fine-tune the behaviour of
2582364920bSroy.Nm
2592364920bSroywith the following options:
2602364920bSroy.Bl -tag -width indent
2612364920bSroy.It Fl b , Fl Fl background
2622364920bSroyBackground immediately.
2632364920bSroyThis is useful for startup scripts which don't disable link messages for
2642364920bSroycarrier status.
2652364920bSroy.It Fl c , Fl Fl script Ar script
2662364920bSroyUse this
2672364920bSroy.Ar script
2682364920bSroyinstead of the default
2692364920bSroy.Pa /libexec/dhcpcd-run-hooks .
2702364920bSroy.It Fl D , Fl Fl duid Op Ar ll | lt | uuid | value
2712364920bSroyUse a DHCP Unique Identifier.
2722364920bSroyIf a system UUID is available, that will be used to create a DUID-UUID,
273794dfa77Sroyotherwise if persistent storage is available then a DUID-LLT
2742364920bSroy(link local address + time) is generated,
2752364920bSroyotherwise DUID-LL is generated (link local address).
2762364920bSroyThe DUID type can be hinted as an optional parameter if the file
2772364920bSroy.Pa /var/db/dhcpcd/duid
2782364920bSroydoes not exist.
2792364920bSroyIf not
2802364920bSroy.Va ll ,
2812364920bSroy.Va lt
2822364920bSroyor
2832364920bSroy.Va uuid
2842364920bSroythen
2852364920bSroy.Va value
2862364920bSroywill be converted from 00:11:22:33 format.
2872364920bSroyThis, plus the IAID will be used as the
2882364920bSroy.Fl I , Fl Fl clientid .
2892364920bSroyThe DUID generated will be held in
2902364920bSroy.Pa /var/db/dhcpcd/duid
2912364920bSroyand should not be copied to other hosts.
2922364920bSroyThis file also takes precedence over the above rules except for setting a value.
2932364920bSroy.It Fl d , Fl Fl debug
2942364920bSroyEcho debug messages to the stderr and syslog.
2952364920bSroy.It Fl E , Fl Fl lastlease
2962364920bSroyIf
2972364920bSroy.Nm
2982364920bSroycannot obtain a lease, then try to use the last lease acquired for the
2992364920bSroyinterface.
3002364920bSroy.It Fl Fl lastleaseextend
3012364920bSroySame as the above, but the lease will be retained even if it expires.
3022364920bSroy.Nm
3032364920bSroywill give it up if any other host tries to claim it for their own via ARP.
3042364920bSroyThis violates RFC 2131, section 3.7, which states the lease should be
3052364920bSroydropped once it has expired.
3062364920bSroy.It Fl e , Fl Fl env Ar value
3072364920bSroyPush
3082364920bSroy.Ar value
3092364920bSroyto the environment for use in
3102364920bSroy.Xr dhcpcd-run-hooks 8 .
3112364920bSroyFor example, you can force the hostname hook to always set the hostname with
3122364920bSroy.Fl e
3132364920bSroy.Va force_hostname=YES .
3142364920bSroy.It Fl g , Fl Fl reconfigure
3152364920bSroy.Nm
3162364920bSroywill re-apply IP address, routing and run
3172364920bSroy.Xr dhcpcd-run-hooks 8
3182364920bSroyfor each interface.
3192364920bSroyThis is useful so that a 3rd party such as PPP or VPN can change the routing
3202364920bSroytable and / or DNS, etc and then instruct
3212364920bSroy.Nm
3222364920bSroyto put things back afterwards.
3232364920bSroy.Nm
3242364920bSroydoes not read a new configuration when this happens - you should rebind if you
3252364920bSroyneed that functionality.
3262364920bSroy.It Fl F , Fl Fl fqdn Ar fqdn
327794dfa77SroyRequests that the DHCP server update DNS using FQDN instead of just a
3282364920bSroyhostname.
3292364920bSroyValid values for
3302364920bSroy.Ar fqdn
3312364920bSroyare disable, none, ptr and both.
3322364920bSroy.Nm
3332364920bSroyitself never does any DNS updates.
3342364920bSroy.Nm
3352364920bSroyencodes the FQDN hostname as specified in
3362364920bSroy.Li RFC 1035 .
3372364920bSroy.It Fl f , Fl Fl config Ar file
3382364920bSroySpecify a config to load instead of
3392364920bSroy.Pa /etc/dhcpcd.conf .
3402364920bSroy.Nm
3412364920bSroyalways processes the config file before any command line options.
3422364920bSroy.It Fl h , Fl Fl hostname Ar hostname
3432364920bSroySends
3442364920bSroy.Ar hostname
3452364920bSroyto the DHCP server so it can be registered in DNS.
3462364920bSroyIf
3472364920bSroy.Ar hostname
3482364920bSroyis an empty string then the current system hostname is sent.
3492364920bSroyIf
3502364920bSroy.Ar hostname
3512364920bSroyis a FQDN (i.e., contains a .) then it will be encoded as such.
3522364920bSroy.It Fl I , Fl Fl clientid Ar clientid
3532364920bSroySend the
3542364920bSroy.Ar clientid .
3552364920bSroyIf the string is of the format 01:02:03 then it is encoded as hex.
3562364920bSroyFor interfaces whose hardware address is longer than 8 bytes, or if the
3572364920bSroy.Ar clientid
3582364920bSroyis an empty string then
3592364920bSroy.Nm
3602364920bSroysends a default
3612364920bSroy.Ar clientid
3622364920bSroyof the hardware family and the hardware address.
3632364920bSroy.It Fl i , Fl Fl vendorclassid Ar vendorclassid
3642364920bSroyOverride the DHCPv4
3652364920bSroy.Ar vendorclassid
3662364920bSroyfield sent.
3672364920bSroyThe default is
3682364920bSroydhcpcd-<version>:<os>:<machine>:<platform>.
3692364920bSroyFor example
3702364920bSroy.D1 dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386
3712364920bSroyIf not set then none is sent.
3722364920bSroySome badly configured DHCP servers reject unknown vendorclassids.
3732364920bSroyTo work around it, try and impersonate Windows by using the MSFT vendorclassid.
3742364920bSroy.It Fl j , Fl Fl logfile Ar logfile
3752364920bSroyWrites to the specified
3762364920bSroy.Ar logfile .
3772364920bSroy.Nm
3782364920bSroystill writes to
3792364920bSroy.Xr syslog 3 .
3802364920bSroyThe
3812364920bSroy.Ar logfile
3822364920bSroyis reopened when
3832364920bSroy.Nm
3842364920bSroyreceives the
3852364920bSroy.Dv SIGUSR2
3862364920bSroysignal.
3872364920bSroy.It Fl k , Fl Fl release Op Ar interface
3882364920bSroyThis causes an existing
3892364920bSroy.Nm
3902364920bSroyprocess running on the
3912364920bSroy.Ar interface
3922364920bSroyto release its lease and de-configure the
3932364920bSroy.Ar interface
3942364920bSroyregardless of the
3952364920bSroy.Fl p , Fl Fl persistent
3962364920bSroyoption.
3972364920bSroyIf no
3982364920bSroy.Ar interface
3992364920bSroyis specified then this applies to all interfaces in Manager mode.
4002364920bSroyIf no interfaces are left running,
4012364920bSroy.Nm
4022364920bSroywill exit.
4032364920bSroy.It Fl l , Fl Fl leasetime Ar seconds
4042364920bSroyRequest a lease time of
4052364920bSroy.Ar seconds .
4062364920bSroy.Ar -1
4072364920bSroyrepresents an infinite lease time.
4082364920bSroyBy default
4092364920bSroy.Nm
4102364920bSroydoes not request any lease time and leaves it in the hands of the
4112364920bSroyDHCP server.
4122364920bSroy.It Fl M , Fl Fl manager
4132364920bSroyStart
4142364920bSroy.Nm
4152364920bSroyin Manager mode even if only one interface specified on the command line.
4162364920bSroySee the Multiple Interfaces section above.
4172364920bSroy.It Fl m , Fl Fl metric Ar metric
4182364920bSroyMetrics are used to prefer an interface over another one, lowest wins.
4192364920bSroy.Nm
4202364920bSroywill supply a default metric of 1000 +
4212364920bSroy.Xr if_nametoindex 3 .
4222364920bSroyThis will be offset by 2000 for wireless interfaces, with additional offsets
4232364920bSroyof 1000000 for IPv4LL and 2000000 for roaming interfaces.
4242364920bSroy.It Fl n , Fl Fl rebind Op Ar interface
4252364920bSroyNotifies
4262364920bSroy.Nm
4272364920bSroyto reload its configuration and rebind the specified
4282364920bSroy.Ar interface .
4292364920bSroyIf no
4302364920bSroy.Ar interface
4312364920bSroyis specified then this applies to all interfaces in Manager mode.
4322364920bSroyIf
4332364920bSroy.Nm
4342364920bSroyis not running, then it starts up as normal.
4352364920bSroy.It Fl N , Fl Fl renew Op Ar interface
4362364920bSroyNotifies
4372364920bSroy.Nm
4382364920bSroyto renew existing addresses on the specified
4392364920bSroy.Ar interface .
4402364920bSroyIf no
4412364920bSroy.Ar interface
4422364920bSroyis specified then this applies to all interfaces in Manager mode.
4432364920bSroyIf
4442364920bSroy.Nm
4452364920bSroyis not running, then it starts up as normal.
4462364920bSroyUnlike the
4472364920bSroy.Fl n , Fl Fl rebind
4482364920bSroyoption above, the configuration for
4492364920bSroy.Nm
4502364920bSroyis not reloaded.
4512364920bSroy.It Fl o , Fl Fl option Ar option
4522364920bSroyRequest the DHCP
4532364920bSroy.Ar option
4542364920bSroyvariable for use in
4552364920bSroy.Pa /libexec/dhcpcd-run-hooks .
4562364920bSroy.It Fl p , Fl Fl persistent
4572364920bSroy.Nm
458c747e301Sroyde-configures the
4592364920bSroy.Ar interface
460c747e301Sroywhen it exits unless this option is enabled.
4612364920bSroySometimes, this isn't desirable if, for example, you have root mounted over
4622364920bSroyNFS or SSH clients connect to this host and they need to be notified of
4632364920bSroythe host shutting down.
4642364920bSroyYou can use this option to stop this from happening.
4652364920bSroy.It Fl r , Fl Fl request Ar address
4662364920bSroyRequest the
4672364920bSroy.Ar address
4682364920bSroyin the DHCP DISCOVER message.
4692364920bSroyThere is no guarantee this is the address the DHCP server will actually give.
4702364920bSroyIf no
4712364920bSroy.Ar address
4722364920bSroyis given then the first address currently assigned to the
4732364920bSroy.Ar interface
4742364920bSroyis used.
4752364920bSroy.It Fl s , Fl Fl inform Ar address Ns Op Ar /cidr Ns Op Ar /broadcast_address
4762364920bSroyBehaves like
4772364920bSroy.Fl r , Fl Fl request
4782364920bSroyas above, but sends a DHCP INFORM instead of DISCOVER/REQUEST.
4792364920bSroyThis does not get a lease as such, just notifies the DHCP server of the
4802364920bSroy.Ar address
4812364920bSroyin use.
4822364920bSroyYou should also include the optional
4832364920bSroy.Ar cidr
4842364920bSroynetwork number in case the address is not already configured on the interface.
4852364920bSroy.Nm
4862364920bSroyremains running and pretends it has an infinite lease.
4872364920bSroy.Nm
4882364920bSroywill not de-configure the interface when it exits.
4892364920bSroyIf
4902364920bSroy.Nm
4912364920bSroyfails to contact a DHCP server then it returns a failure instead of falling
4922364920bSroyback on IPv4LL.
4932364920bSroy.It Fl Fl inform6
4942364920bSroyPerforms a DHCPv6 Information Request.
4952364920bSroyNo address is requested or specified, but all other DHCPv6 options are allowed.
4962364920bSroyThis is normally performed automatically when the IPv6 Router Advertises
4972364920bSroythat the client should perform this operation.
4982364920bSroyThis option is only needed when
4992364920bSroy.Nm
5002364920bSroyis not processing IPv6RA messages and the need for DHCPv6 Information Request
5012364920bSroyexists.
5022364920bSroy.It Fl S , Fl Fl static Ar value
5032364920bSroyConfigures a static DHCP
5042364920bSroy.Ar value .
5052364920bSroyIf you set
5062364920bSroy.Ic ip_address
5072364920bSroythen
5082364920bSroy.Nm
5092364920bSroywill not attempt to obtain a lease and just use the value for the address with
5102364920bSroyan infinite lease time.
5112364920bSroy.Pp
5122364920bSroyHere is an example which configures a static address, routes and DNS.
5132364920bSroy.D1 dhcpcd -S ip_address=192.168.0.10/24 \e
5142364920bSroy.D1 -S routers=192.168.0.1 \e
5152364920bSroy.D1 -S domain_name_servers=192.168.0.1 \e
5162364920bSroy.D1 eth0
5172364920bSroy.Pp
5182364920bSroyYou cannot presently set static DHCPv6 values.
5192364920bSroyUse the
5202364920bSroy.Fl e , Fl Fl env
5212364920bSroyoption instead.
5222364920bSroy.It Fl t , Fl Fl timeout Ar seconds
5232364920bSroyTimeout after
5242364920bSroy.Ar seconds ,
5252364920bSroyinstead of the default 30.
5262364920bSroyA setting of 0
5272364920bSroy.Ar seconds
5282364920bSroycauses
5292364920bSroy.Nm
5302364920bSroyto wait forever to get a lease.
5312364920bSroyIf
5322364920bSroy.Nm
5332364920bSroyis working on a single interface then
5342364920bSroy.Nm
5352364920bSroywill exit when a timeout occurs, otherwise
5362364920bSroy.Nm
5372364920bSroywill fork into the background.
5382364920bSroy.It Fl u , Fl Fl userclass Ar class
5392364920bSroyTags the DHCPv4 message with the userclass
5402364920bSroy.Ar class .
5412364920bSroyDHCP servers use this to give members of the class DHCP options other than the
5422364920bSroydefault, without having to know things like hardware address or hostname.
5432364920bSroy.It Fl v , Fl Fl vendor Ar code , Ns Ar value
5442364920bSroyAdd an encapsulated vendor option.
5452364920bSroy.Ar code
5462364920bSroyshould be between 1 and 254 inclusive.
5472364920bSroyTo add a raw vendor string, omit
5482364920bSroy.Ar code
5492364920bSroybut keep the comma.
5502364920bSroyExamples.
5512364920bSroy.Pp
5522364920bSroySet the vendor option 01 with an IP address.
5532364920bSroy.D1 dhcpcd \-v 01,192.168.0.2 eth0
5542364920bSroySet the vendor option 02 with a hex code.
5552364920bSroy.D1 dhcpcd \-v 02,01:02:03:04:05 eth0
5562364920bSroySet the vendor option 03 with an IP address as a string.
5572364920bSroy.D1 dhcpcd \-v 03,\e"192.168.0.2\e" eth0
5582364920bSroySet un-encapsulated vendor option to hello world.
5592364920bSroy.D1 dhcpcd \-v ,"hello world" eth0
5602364920bSroy.It Fl Fl version
5612364920bSroyDisplay both program version and copyright information.
5622364920bSroy.Nm
5632364920bSroythen exits before doing any configuration.
5642364920bSroy.It Fl w
5652364920bSroyWait for an address to be assigned before forking to the background.
5662364920bSroyDoes not take an argument, unlike the below option.
5672364920bSroy.It Fl Fl waitip Ns = Ns Op 4 | 6
5682364920bSroyWait for an address to be assigned before forking to the background.
5692364920bSroy4 means wait for an IPv4 address to be assigned.
5702364920bSroy6 means wait for an IPv6 address to be assigned.
5712364920bSroyIf no argument is given,
5722364920bSroy.Nm
5732364920bSroywill wait for any address protocol to be assigned.
5742364920bSroyIt is possible to wait for more than one address protocol and
5752364920bSroy.Nm
5762364920bSroywill only fork to the background when all waiting conditions are satisfied.
5772364920bSroy.It Fl x , Fl Fl exit Op Ar interface
5782364920bSroyThis will signal an existing
5792364920bSroy.Nm
5802364920bSroyprocess running on the
5812364920bSroy.Ar interface
5822364920bSroyto exit.
5832364920bSroyIf no
5842364920bSroy.Ar interface
5852364920bSroyis specified, then the above is applied to all interfaces in Manager mode.
5862364920bSroySee the
5872364920bSroy.Fl p , Fl Fl persistent
5882364920bSroyoption to control configuration persistence on exit,
5892364920bSroywhich is enabled by default in
5902364920bSroy.Xr dhcpcd.conf 5 .
5912364920bSroy.Nm
5922364920bSroythen waits until this process has exited.
5932364920bSroy.It Fl y , Fl Fl reboot Ar seconds
5942364920bSroyAllow
5952364920bSroy.Ar reboot
5962364920bSroyseconds before moving to the discover phase if we have an old lease to use.
5972364920bSroyAllow
5982364920bSroy.Ar reboot
5992364920bSroyseconds before starting fallback states from the discover phase.
6002364920bSroyIPv4LL is started when the first
6012364920bSroy.Ar reboot
6022364920bSroytimeout is reached.
6032364920bSroyThe default is 5 seconds.
6042364920bSroyA setting of 0 seconds causes
6052364920bSroy.Nm
6062364920bSroyto skip the reboot phase and go straight into discover.
6072364920bSroyThis has no effect on DHCPv6 other than skipping the reboot phase.
6082364920bSroy.El
6092364920bSroy.Ss Restricting behaviour
6102364920bSroy.Nm
6112364920bSroywill try to do as much as it can by default.
6122364920bSroyHowever, there are sometimes situations where you don't want the things to be
6132364920bSroyconfigured exactly how the DHCP server wants.
6142364920bSroyHere are some options that deal with turning these bits off.
6152364920bSroy.Pp
6162364920bSroyNote that when
6172364920bSroy.Nm
6182364920bSroyis restricted to a single interface then the interface also needs to be
6192364920bSroyspecified when asking
6202364920bSroy.Nm
6212364920bSroyto exit using the commandline.
6222364920bSroyIf the protocol is restricted as well then the protocol needs to be included
6232364920bSroywith the exit instruction.
6242364920bSroy.Bl -tag -width indent
6252364920bSroy.It Fl 1 , Fl Fl oneshot
6262364920bSroyExit after configuring an interface.
6272364920bSroyUse the
6282364920bSroy.Fl w , Fl Fl waitip
6292364920bSroyoption to specify which protocol(s) to configure before exiting.
6302364920bSroy.It Fl 4 , Fl Fl ipv4only
6312364920bSroyConfigure IPv4 only.
6322364920bSroy.It Fl 6 , Fl Fl ipv6only
6332364920bSroyConfigure IPv6 only.
6342364920bSroy.It Fl A , Fl Fl noarp
6352364920bSroyDon't request or claim the address by ARP.
6362364920bSroyThis also disables IPv4LL.
6372364920bSroy.It Fl B , Fl Fl nobackground
6382364920bSroyDon't run in the background when we acquire a lease.
6392364920bSroyThis is mainly useful for running under the control of another process, such
6402364920bSroyas a debugger or a network manager.
6412364920bSroy.It Fl C , Fl Fl nohook Ar script
6422364920bSroyDon't run this hook script.
6432364920bSroyMatches full name, or prefixed with 2 numbers optionally ending with
6442364920bSroy.Pa .sh .
6452364920bSroy.Pp
6462364920bSroySo to stop
6472364920bSroy.Nm
6482364920bSroyfrom touching your DNS settings you would do:-
6492364920bSroy.D1 dhcpcd -C resolv.conf eth0
6502364920bSroy.It Fl G , Fl Fl nogateway
6512364920bSroyDon't set any default routes.
6522364920bSroy.It Fl H , Fl Fl xidhwaddr
6532364920bSroyUse the last four bytes of the hardware address as the DHCP xid instead
6542364920bSroyof a randomly generated number.
6552364920bSroy.It Fl J , Fl Fl broadcast
6562364920bSroyInstructs the DHCP server to broadcast replies back to the client.
6572364920bSroyNormally this is only set for non-Ethernet interfaces,
6582364920bSroysuch as FireWire and InfiniBand.
6592364920bSroyIn most instances,
6602364920bSroy.Nm
6612364920bSroywill set this automatically.
6622364920bSroy.It Fl K , Fl Fl nolink
6632364920bSroyDon't receive link messages for carrier status.
6642364920bSroyYou should only have to use this with buggy device drivers or running
6652364920bSroy.Nm
6662364920bSroythrough a network manager.
6672364920bSroy.It Fl L , Fl Fl noipv4ll
6682364920bSroyDon't use IPv4LL (aka APIPA, aka Bonjour, aka ZeroConf).
6692364920bSroy.It Fl O , Fl Fl nooption Ar option
6702364920bSroyRemoves the
6712364920bSroy.Ar option
6722364920bSroyfrom the DHCP message before processing.
6732364920bSroy.It Fl P , Fl Fl printpidfile
6742364920bSroyPrint the
6752364920bSroy.Pa pidfile
6762364920bSroy.Nm
677794dfa77Sroywill use based on command-line arguments to stdout.
6782364920bSroy.It Fl Q , Fl Fl require Ar option
6792364920bSroyRequires the
6802364920bSroy.Ar option
6812364920bSroyto be present in all DHCP messages, otherwise the message is ignored.
6822364920bSroyTo enforce that
6832364920bSroy.Nm
6842364920bSroyonly responds to DHCP servers and not BOOTP servers, you can
6852364920bSroy.Fl Q
6862364920bSroy.Ar dhcp_message_type .
6872364920bSroy.It Fl q , Fl Fl quiet
6882364920bSroyQuiet
6892364920bSroy.Nm
6902364920bSroyon the command line, only warnings and errors will be displayed.
6912364920bSroyIf this option is used another time then all console output is disabled.
6922364920bSroyThese messages are still logged via
6932364920bSroy.Xr syslog 3 .
6942364920bSroy.It Fl T , Fl Fl test
6952364920bSroyOn receipt of DHCP messages just call
6962364920bSroy.Pa /libexec/dhcpcd-run-hooks
6972364920bSroywith the reason of TEST which echos the DHCP variables found in the message
6982364920bSroyto the console.
6992364920bSroyThe interface configuration isn't touched and neither are any configuration
7002364920bSroyfiles.
7012364920bSroyThe
7022364920bSroy.Ar rapid_commit
7032364920bSroyoption is not sent in TEST mode so that the server does not lease an address.
7042364920bSroyTo test INFORM the interface needs to be configured with the desired address
7052364920bSroybefore starting
7062364920bSroy.Nm .
7072364920bSroy.It Fl U , Fl Fl dumplease Op Ar interface
7082364920bSroyDumps the current lease for the
7092364920bSroy.Ar interface
7102364920bSroyto stdout.
7112364920bSroyIf no
7122364920bSroy.Ar interface
7132364920bSroyis given then all interfaces are dumped.
7142364920bSroyUse the
7152364920bSroy.Fl 4
7162364920bSroyor
7172364920bSroy.Fl 6
7182364920bSroyflags to specify an address family.
7192364920bSroyIf a lease is piped in via standard input then that is dumped.
7202364920bSroyIn this case, specifying an address family is mandatory.
7212364920bSroy.It Fl V , Fl Fl variables
7222364920bSroyDisplay a list of option codes, the associated variable and encoding for use in
7232364920bSroy.Xr dhcpcd-run-hooks 8 .
7242364920bSroyVariables are prefixed with new_ and old_ unless the option number is -.
7252364920bSroyVariables without an option are part of the DHCP message and cannot be
7262364920bSroydirectly requested.
7272364920bSroy.It Fl W , Fl Fl whitelist Ar address Ns Op /cidr
7282364920bSroyOnly accept packets from
7292364920bSroy.Ar address Ns Op /cidr .
7302364920bSroy.Fl X , Fl Fl blacklist
7312364920bSroyis ignored if
7322364920bSroy.Fl W , Fl Fl whitelist
7332364920bSroyis set.
7342364920bSroy.It Fl X , Fl Fl blacklist Ar address Ns Op Ar /cidr
7352364920bSroyIgnore all packets from
7362364920bSroy.Ar address Ns Op Ar /cidr .
7372364920bSroy.It Fl Z , Fl Fl denyinterfaces Ar pattern
7382364920bSroyWhen discovering interfaces, the interface name must not match
7392364920bSroy.Ar pattern
7402364920bSroywhich is a space or comma separated list of patterns passed to
7412364920bSroy.Xr fnmatch 3 .
7422364920bSroy.It Fl z , Fl Fl allowinterfaces Ar pattern
7432364920bSroyWhen discovering interfaces, the interface name must match
7442364920bSroy.Ar pattern
7452364920bSroywhich is a space or comma separated list of patterns passed to
7462364920bSroy.Xr fnmatch 3 .
7472364920bSroyIf the same interface is matched in
7482364920bSroy.Fl Z , Fl Fl denyinterfaces
7492364920bSroythen it is still denied.
7502364920bSroy.It Fl Fl inactive
7512364920bSroyDon't start any interfaces other than those specified on the command line.
7522364920bSroyThis allows
7532364920bSroy.Nm
7542364920bSroyto be started in Manager mode and then wait for subsequent
7552364920bSroy.Nm
7562364920bSroycommands to start each interface as required.
7572364920bSroy.It Fl Fl configure
7582364920bSroyAllows
7592364920bSroy.Nm
7602364920bSroyto configure the system.
7612364920bSroyThis is the default behaviour and sets
7622364920bSroy.Ev if_configured=true .
7632364920bSroy.It Fl Fl noconfigure
7642364920bSroy.Nm
7652364920bSroywill not configure the system at all.
7662364920bSroyThis is only of use if the
7672364920bSroy.Fl Fl script
7682364920bSroythat
7692364920bSroy.Nm
7702364920bSroycalls at each network event configures the system instead.
7712364920bSroyThis is different from
7722364920bSroy.Fl T , Fl Fl test
7732364920bSroymode in that it's not one shot and the only change to the environment is the
7742364920bSroyaddition of
7752364920bSroy.Ev if_configured=false .
7762364920bSroy.It Fl Fl nodev
7772364920bSroyDon't load any
7782364920bSroy.Pa /dev
7792364920bSroymanagement modules.
7802364920bSroy.El
7812364920bSroy.Sh 3RDPARTY LINK MANAGEMENT
7822364920bSroySome interfaces require configuration by 3rd parties, such as PPP or VPN.
7832364920bSroyWhen an interface configuration in
7842364920bSroy.Nm
7852364920bSroyis marked as STATIC or INFORM without an address then
7862364920bSroy.Nm
7872364920bSroywill monitor the interface until an address is added or removed from it and
7882364920bSroyact accordingly.
7892364920bSroyFor point to point interfaces (like PPP), a default route to its
7902364920bSroydestination is automatically added to the configuration.
7912364920bSroyIf the point to point interface is configured for INFORM, then
7922364920bSroy.Nm
7932364920bSroyunicasts INFORM to the destination, otherwise it defaults to STATIC.
7942364920bSroy.Sh NOTES
7952364920bSroy.Nm
796794dfa77Sroyrequires a Berkeley Packet Filter, or BPF device on BSD based systems and a
7972364920bSroyLinux Socket Filter, or LPF device on Linux based systems for all IPv4
7982364920bSroyconfiguration.
7992364920bSroy.Pp
8002364920bSroyIf restricting
8012364920bSroy.Nm
8022364920bSroyto a single interface and optionally address family via the command-line
8032364920bSroythen all further calls to
8042364920bSroy.Nm
8052364920bSroyto rebind, reconfigure or exit need to include the same restrictive flags
8062364920bSroyso that
8072364920bSroy.Nm
8082364920bSroyknows which process to signal.
8092364920bSroy.Pp
8102364920bSroySome DHCP servers implement ClientID filtering.
8112364920bSroyIf
8122364920bSroy.Nm
8132364920bSroyis replacing an in-use DHCP client then you might need to adjust the clientid
8142364920bSroyoption
8152364920bSroy.Nm
8162364920bSroysends to match.
8172364920bSroyIf using a DUID in place of the ClientID, edit
8182364920bSroy.Pa /var/db/dhcpcd/duid
8192364920bSroyaccordingly.
8202364920bSroy.Sh FILES
8212364920bSroy.Bl -ohang
8222364920bSroy.It Pa /etc/dhcpcd.conf
8232364920bSroyConfiguration file for dhcpcd.
8242364920bSroyIf you always use the same options, put them here.
8252364920bSroy.It Pa /libexec/dhcpcd-run-hooks
8262364920bSroyBourne shell script that is run to configure or de-configure an interface.
8272364920bSroy.It Pa /lib/dhcpcd/dev
8282364920bSroyLinux
8292364920bSroy.Pa /dev
8302364920bSroymanagement modules.
8312364920bSroy.It Pa /libexec/dhcpcd-hooks
832794dfa77SroyA directory containing Bourne shell scripts that are run by the above script.
8332364920bSroyEach script can be disabled by using the
8342364920bSroy.Fl C , Fl Fl nohook
8352364920bSroyoption described above.
8362364920bSroy.It Pa /var/db/dhcpcd/duid
8372364920bSroyText file that holds the DUID used to identify the host.
8382364920bSroy.It Pa /var/db/dhcpcd/secret
8392364920bSroyText file that holds a secret key known only to the host.
8402364920bSroy.It Pa /var/db/dhcpcd/ Ns Ar interface Ns Ar -ssid Ns .lease
8412364920bSroyThe actual DHCP message sent by the server.
8422364920bSroyWe use this when reading the last
8432364920bSroylease and use the file's mtime as when it was issued.
8442364920bSroy.It Pa /var/db/dhcpcd/ Ns Ar interface Ns Ar -ssid Ns .lease6
8452364920bSroyThe actual DHCPv6 message sent by the server.
8462364920bSroyWe use this when reading the last
8472364920bSroylease and use the file's mtime as when it was issued.
8482364920bSroy.It Pa /var/db/dhcpcd/rdm_monotonic
8492364920bSroyStores the monotonic counter used in the
8502364920bSroy.Ar replay
8512364920bSroyfield in Authentication Options.
8522364920bSroy.It Pa /var/run/dhcpcd/pid
8532364920bSroyStores the PID of
8542364920bSroy.Nm
8552364920bSroyrunning on all interfaces.
8562364920bSroy.It Pa /var/run/dhcpcd/ Ns Ar interface Ns .pid
8572364920bSroyStores the PID of
8582364920bSroy.Nm
8592364920bSroyrunning on the
8602364920bSroy.Ar interface .
8612364920bSroy.It Pa /var/run/dhcpcd/sock
8622364920bSroyControl socket to the manager daemon.
8632364920bSroy.It Pa /var/run/dhcpcd/unpriv.sock
8642364920bSroyUnprivileged socket to the manager daemon, only allows state retrieval.
8652364920bSroy.It Pa /var/run/dhcpcd/ Ns Ar interface Ns .sock
8662364920bSroyControl socket to per interface daemon.
8672364920bSroy.It Pa /var/run/dhcpcd/ Ns Ar interface Ns .unpriv.sock
8682364920bSroyUnprivileged socket to per interface daemon, only allows state retrieval.
8692364920bSroy.El
8702364920bSroy.Sh SEE ALSO
8712364920bSroy.Xr fnmatch 3 ,
8722364920bSroy.Xr if_nametoindex 3 ,
8732364920bSroy.Xr dhcpcd.conf 5 ,
8742364920bSroy.Xr resolv.conf 5 ,
8752364920bSroy.Xr dhcpcd-run-hooks 8 ,
8762364920bSroy.Xr resolvconf 8
8772364920bSroy.Sh STANDARDS
8782364920bSroyRFC\ 951, RFC\ 1534, RFC\ 2104, RFC\ 2131, RFC\ 2132, RFC\ 2563, RFC\ 2855,
8792364920bSroyRFC\ 3004, RFC\ 3118, RFC\ 3203, RFC\ 3315, RFC\ 3361, RFC\ 3633, RFC\ 3396,
8802364920bSroyRFC\ 3397, RFC\ 3442, RFC\ 3495, RFC\ 3925, RFC\ 3927, RFC\ 4039, RFC\ 4075,
8812364920bSroyRFC\ 4242, RFC\ 4361, RFC\ 4390, RFC\ 4702, RFC\ 4074, RFC\ 4861, RFC\ 4833,
8822364920bSroyRFC\ 4941, RFC\ 5227, RFC\ 5942, RFC\ 5969, RFC\ 6106, RFC\ 6334, RFC\ 6355,
8832364920bSroyRFC\ 6603, RFC\ 6704, RFC\ 7217, RFC\ 7550, RFC\ 7844.
8842364920bSroy.Sh AUTHORS
8852364920bSroy.An Roy Marples Aq Mt roy@marples.name
8862364920bSroy.Sh BUGS
8872364920bSroyPlease report them to
888794dfa77Sroy.Lk https://roy.marples.name/projects/dhcpcd
889