xref: /netbsd-src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5 (revision 4dcbd9d51df09925020675ff6a321399c52152e4)
1.\" SPDX-License-Identifier: BSD-2-Clause
2.\"
3.\" Copyright (c) 2006-2023 Roy Marples
4.\" All rights reserved
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd May 24, 2024
28.Dt DHCPCD.CONF 5
29.Os
30.Sh NAME
31.Nm dhcpcd.conf
32.Nd dhcpcd configuration file
33.Sh DESCRIPTION
34Although
35.Nm dhcpcd
36can do everything from the command line, there are cases where it's just easier
37to do it once in a configuration file.
38Most of the options found in
39.Xr dhcpcd 8
40can be used here.
41The first word on the line is the option and the rest of the line is the value.
42Leading and trailing whitespace for the option and value are trimmed.
43You can escape characters in the value using the \\ character.
44Comments can be prefixed with the # character.
45String values should be quoted with the " character.
46.Pp
47Here's a list of available options:
48.Bl -tag -width indent
49.It Ic allowinterfaces Ar pattern
50When discovering interfaces, the interface name must match
51.Ar pattern
52which is a space or comma separated list of patterns passed to
53.Xr fnmatch 3 .
54If the same interface is matched in
55.Ic denyinterfaces
56then it is still denied.
57.It Ic denyinterfaces Ar pattern
58When discovering interfaces, the interface name must not match
59.Ar pattern
60which is a space or comma separated list of patterns passed to
61.Xr fnmatch 3 .
62.It Ic anonymous
63Enables Anonymity Profiles for DHCP, RFC 7844.
64Any DUID is ignored and ClientID is set to LL only.
65All non essential options are then masked at this point,
66but they could be unmasked by explicitly requesting the option
67.Sy after
68the
69.Ic anonymous
70option is processed.
71As such, the
72.Ic anonymous
73option
74.Sy should
75be the last option in the configuration unless you really want to
76send something which could identify you.
77.Nm dhcpcd
78will not try and reboot an old lease, it will go straight into
79DISCOVER/SOLICIT.
80.It Ic randomise_hwaddr
81Forces a hardware address randomisation when the interface is brought up
82or when the carrier is lost.
83This is generally used in tandem with the anonymous option.
84.It Ic arping Ar address Op address
85.Nm dhcpcd
86will arping each address in order before attempting DHCP.
87If an address is found, we will select the replying hardware address as the
88profile, otherwise the IP address.
89Example:
90.Pp
91.D1 interface bge0
92.D1 arping 192.168.0.1
93.Pp
94.D1 # My specific 192.168.0.1 network
95.D1 profile dd:ee:aa:dd:bb:ee
96.D1 static ip_address=192.168.0.10/24
97.Pp
98.D1 # A generic 192.168.0.1 network
99.D1 profile 192.168.0.1
100.D1 static ip_address=192.168.0.98/24
101.It Ic authprotocol Ar protocol Op Ar algorithm Op Ar rdm
102Authenticate DHCP messages.
103See the Supported Authentication Protocols section.
104If
105.Ar protocol
106is
107.Ar token
108then
109.Ar algorithm is
110snd_secretid/rcv_secretid so you can send and receive different tokens.
111.It Ic authtoken Ar secretid Ar realm Ar expire Ar key
112Define a shared key for use in authentication.
113.Ar realm
114can be "" to for use with the
115.Ar delayed
116protocol.
117.Ar expire
118is the date the token expires and should be formatted "yyy-mm-dd HH:MM".
119You can use the keyword
120.Ar forever
121or
122.Ar 0
123which means the token never expires.
124For the token protocol,
125.Ar secretid
126needs to be 0 and
127.Ar realm
128needs to be "".
129If
130.Nm dhcpcd
131has the error
132.D1 dhcp_auth_encode: Invalid argument
133then it means that
134.Nm dhcpcd
135could not find the correct authentication token in your configuration.
136.It Ic background
137Fork to the background immediately.
138This is useful for startup scripts which don't disable link messages for
139carrier status.
140.It Ic blacklist Ar address Ns Op /cidr
141Ignores all packets from
142.Ar address Ns Op /cidr .
143.It Ic whitelist Ar address Ns Op /cidr
144Only accept packets from
145.Ar address Ns Op /cidr .
146.Ic blacklist
147is ignored if
148.Ic whitelist
149is set.
150.It Ic bootp
151Be a BOOTP client.
152Basically, this just doesn't send a DHCP Message Type option and will only
153interact with a BOOTP server.
154All other DHCP options still work.
155.It Ic broadcast
156Instructs the DHCP server to broadcast replies back to the client.
157Normally this is only set for non-Ethernet interfaces,
158such as FireWire and InfiniBand.
159In most cases,
160.Nm dhcpcd
161will set this automatically.
162.It Ic controlgroup Ar group
163Sets the group ownership of
164.Pa /var/run/dhcpcd/sock
165so that users other than root can connect to
166.Nm dhcpcd .
167.It Ic debug
168Echo debug messages to the stderr and syslog.
169.It Ic dev Ar value
170Load the
171.Ar value
172.Pa /dev
173management module.
174.Nm dhcpcd
175will load the first one found to work, if any.
176.It Ic env Ar value
177Push
178.Ar value
179to the environment for use in
180.Xr dhcpcd-run-hooks 8 .
181For example, you can force the hostname hook to always set the hostname with
182.Ic env
183.Va force_hostname=YES .
184Or set which driver
185.Xr wpa_supplicant 8
186should use with
187.Ic env
188.Va wpa_supplicant_driver=nl80211
189.Pp
190If the hostname is set, it will be will set to the FQDN if possible as per
191RFC 4702, section 3.1.
192If the FQDN option is missing,
193.Nm dhcpcd
194will still try and set a FQDN from the hostname and domain options for
195consistency.
196To override this, set
197.Ic env
198.Va hostname_fqdn=[YES|NO|SERVER] .
199A value of
200.Va SERVER
201means just what the server says, don't manipulate it.
202This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
203where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
204DHCPv6 has no hostname option.
205.It Ic clientid Ar string
206Send the
207.Ar clientid .
208If the string is of the format 01:02:03 then it is encoded as hex.
209For interfaces whose hardware address is longer than 8 bytes, or if the
210.Ar clientid
211is an empty string then
212.Nm dhcpcd
213sends a default
214.Ar clientid
215of the hardware family and the hardware address.
216.It Ic duid Op ll | lt | uuid | value
217Use a DHCP Unique Identifier.
218If a system UUID is available, that will be used to create a DUID-UUID,
219otherwise if persistent storage is available then a DUID-LLT
220(link local address + time) is generated,
221otherwise DUID-LL is generated (link local address).
222The DUID type can be hinted as an optional parameter if the file
223.Pa /var/db/dhcpcd/duid
224does not exist.
225If not
226.Va ll ,
227.Va lt
228or
229.Va uuid
230then
231.Va value
232will be converted from 00:11:22:33 format.
233This, plus the IAID will be used as the
234.Ic clientid .
235The DUID generated will be held in
236.Pa /var/db/dhcpcd/duid
237and should not be copied to other hosts.
238This file also takes precedence over the above rules except for setting a value.
239.It Ic iaid Ar iaid
240Set the Interface Association Identifier to
241.Ar iaid .
242This option must be used in an
243.Ic interface
244block.
245This defaults to the VLANID (prefixed with 0xff) for the interface if set,
246otherwise the last 4 bytes of the hardware address assigned to the
247interface.
248Each instance of this should be unique within the scope of the client and
249.Nm dhcpcd
250warns if a conflict is detected.
251If there is a conflict, it is only a problem if the conflicted IAIDs are
252used on the same network.
253.It Ic dhcp
254Enable DHCP on the interface, on by default.
255.It Ic dhcp6
256Enable DHCPv6 on the interface, on by default.
257.It Ic ipv4
258Enable IPv4 on the interface, on by default.
259.It Ic ipv6
260Enable IPv6 on the interface, on by default.
261.It Ic request Op Ar address
262Request the
263.Ar address
264in the DHCP DISCOVER message.
265There is no guarantee this is the address the DHCP server will actually give.
266If no
267.Ar address
268is given then the first address currently assigned to the
269.Ar interface
270is used.
271.It Ic inform Op Ar address Ns Op Ar /cidr Ns Op Ar /broadcast_address
272Behaves like
273.Ic request
274as above, but sends a DHCP INFORM instead of DISCOVER/REQUEST.
275This does not get a lease as such, just notifies the DHCP server of the
276.Ar address
277in use.
278You should also include the optional
279.Ar cidr
280network number in case the address is not already configured on the interface.
281.Nm dhcpcd
282remains running and pretends it has an infinite lease.
283.Nm dhcpcd
284will not de-configure the interface when it exits.
285If
286.Nm dhcpcd
287fails to contact a DHCP server then it returns a failure instead of falling
288back on IPv4LL.
289.It Ic inform6
290Performs a DHCPv6 Information Request.
291No address is requested or specified, but all other DHCPv6 options are allowed.
292This is normally performed automatically when an IPv6 Router Advertisement
293indicates that the client should perform this operation.
294This option is only needed when
295.Nm dhcpcd
296is not processing IPv6 RA messages and the need for a DHCPv6 Information Request
297exists.
298.It Ic persistent
299.Nm dhcpcd
300normally de-configures the interface and configuration when it exits.
301Sometimes, this isn't desirable if, for example, you have root mounted over
302NFS or SSH clients connect to this host and they need to be notified of
303the host shutting down.
304You can use this option to stop this from happening.
305.It Ic fallback Ar profile
306Fall back to using this profile if DHCP fails.
307This allows you to configure a static profile instead of using ZeroConf.
308.It Ic fallback_time Ar seconds
309Start fallback after
310.Ar seconds .
311The default is 5 seconds.
312.It Ic hostname Ar name
313Sends the hostname
314.Ar name
315to the DHCP server so it can be registered in DNS.
316If
317.Ar name
318is an empty string then the current system hostname is sent.
319If
320.Ar name
321is a FQDN (i.e., contains a .) then it will be encoded as such.
322.It Ic hostname_short
323Sends the short hostname to the DHCP server instead of the FQDN.
324This is useful because DHCP servers will not register the FQDN in their
325DNS if the domain part does not match theirs.
326.Pp
327Also, see the
328.Ic env
329option above to control how the hostname is set on the host.
330.It Ic ia_na Op Ar iaid Op / address
331Request a DHCPv6 Normal Address for
332.Ar iaid .
333.Ar iaid
334defaults to the
335.Ic iaid
336option as described above.
337You can request more than one ia_na by specifying a unique
338.Ar iaid
339for each one.
340.It Ic ia_ta Op Ar iaid
341Request a DHCPv6 Temporary Address for
342.Ar iaid .
343You can request more than one ia_ta by specifying a unique
344.Ar iaid
345for each one.
346.It Ic ia_pd Op Ar iaid Oo / Ar prefix / Ar prefix_len Oc Op Ar interface Op / Ar sla_id Op / Ar prefix_len Op / Ar suffix
347Request a DHCPv6 Delegated Prefix for
348.Ar iaid .
349This option must be used in an
350.Ic interface
351block.
352Unless a
353.Ar sla_id
354of 0 is assigned with the same resultant prefix length as the delegation,
355a reject route is installed for the Delegated Prefix to
356stop unallocated addresses being resolved upstream.
357If no
358.Ar interface
359is given then we will assign a prefix to every other interface with a
360.Ar sla_id
361equivalent to the interface index assigned by the OS.
362Otherwise addresses are only assigned for each
363.Ar interface
364and
365.Ar sla_id .
366To avoid delegating to any interface, use - as the invalid interface name.
367Each assigned address will have a
368.Ar suffix ,
369defaulting to 1.
370If the
371.Ar suffix
372is 0 then a SLAAC address is assigned.
373You cannot assign a prefix to the requesting interface unless the
374DHCPv6 server supports the
375.Li RFC 6603
376Prefix Exclude Option.
377.Nm dhcpcd
378has to be running for all the interfaces it is delegating to.
379A default
380.Ar prefix_len
381of 64 is assumed, unless the maximum
382.Ar sla_id
383does not fit.
384In this case
385.Ar prefix_len
386is increased to the highest multiple of 8 that can accommodate the
387.Ar sla_id .
388.Ar sla_id
389is an integer which must be unique inside the
390.Ar iaid
391and is added to the prefix which must fit inside
392.Ar prefix_len
393less the length of the delegated prefix.
394You can specify multiple
395.Ar interface /
396.Ar sla_id /
397.Ar prefix_len
398per
399.Ic ia_pd ,
400space separated.
401IPv6RS should be disabled globally when requesting a Prefix Delegation.
402.Pp
403In the following example eth0 is the externally facing interface to be
404configured for both IPv4 and IPv6.
405The DHCPv4 server will provide us with an IPv4 address and a default route.
406The DHCPv6 server is going to provide us with an IPv6 address, a default
407route and a /64 subnet to be delegated to the internal interface.
408The eth1 interface will be automatically configured
409for IPv6 using the first address (::1) from the delegated prefix.
410A second prefix is requested and assigned to two other interfaces.
411.Xr rtadvd 8
412can be used with an empty configuration file on eth1, eth2 and eth3,
413to provide automatic
414IPv6 address configuration for the internal network.
415.Bd -literal
416noipv6rs                 # disable routing solicitation
417denyinterfaces eth2      # Don't touch eth2 at all
418interface eth0
419  ipv6rs                 # enable routing solicitation for eth0
420  ia_na 1                # request an IPv6 address
421  ia_pd 2 eth1/0         # request a PD and assign it to eth1
422  ia_pd 3 eth2/1 eth3/2  # req a PD and assign it to eth2 and eth3
423  ia_pd 4 -              # request a PD but don't assign it
424.Ed
425.It Ic ipv4only
426Only configure IPv4.
427.It Ic ipv6only
428Only configure IPv6.
429.It Ic fqdn Op disable | none | ptr | both
430.Ar none
431will not ask the DHCP server to update DNS.
432.Ar ptr
433just asks the DHCP server to update the PTR
434record of the host in DNS, whereas
435.Ar both
436also updates the A record.
437.Ar disable
438will disable the FQDN option.
439The default is
440.Ar both .
441.Nm dhcpcd
442itself never does any DNS updates.
443.Nm dhcpcd
444encodes the FQDN hostname as specified in
445.Li RFC 1035 .
446.It Ic interface Ar interface
447Subsequent options are only parsed for this
448.Ar interface .
449.It Ic ipv4ll_time Ar seconds
450Wait for
451.Ar seconds
452before starting IPv4LL.
453The default is 5 seconds.
454.It Ic ipv6ra_autoconf
455Generate SLAAC addresses for each Prefix advertised by an IPv6
456Router Advertisement message with the Auto flag set.
457On by default.
458.It Ic ipv6ra_noautoconf
459Disables the above option.
460.It Ic ipv6ra_fork
461By default, when
462.Nm dhcpcd
463receives an IPv6 Router Advertisement,
464.Nm dhcpcd
465will only fork to the background if the RA contains at least one unexpired
466RDNSS option and a valid prefix or no DHCPv6 instruction.
467Set this option so to make
468.Nm dhcpcd
469always fork on a RA.
470.It Ic ipv6rs
471Enables IPv6 Router Advertisement solicitation.
472This is on by default, but is documented here in the case where it is disabled
473globally but needs to be enabled for one interface.
474.It Ic leasetime Ar seconds
475Request DHCP a lease time of
476.Ar seconds .
477.Ar -1
478represents an infinite lease time.
479By default
480.Nm dhcpcd
481does not request any lease time and leaves it in the hands of the
482DHCP server.
483It is not possible to request a DHCPv6 lease time as this is not RFC compliant.
484See RFC 8415 21.4, 21.6, 21.21 and 21.22.
485.It Ic link_rcvbuf Ar size
486Override the size of the link receive buffer from the kernel default.
487While
488.Nm dhcpcd
489will recover from link buffer overflows,
490this may not be desirable on heavily loaded systems.
491.It Ic logfile Ar logfile
492Writes to the specified
493.Ar logfile .
494.Nm dhcpcd
495still writes to
496.Xr syslog 3 .
497The
498.Ar logfile
499is reopened when
500.Nm dhcpcd
501receives the
502.Dv SIGUSR2
503signal.
504.It Ic metric Ar metric
505Metrics are used to prefer an interface over another one, lowest wins.
506.Nm dhcpcd
507will supply a default metric of 1000 +
508.Xr if_nametoindex 3 .
509This will be offset by 2000 for wireless interfaces, with additional offsets
510of 1000000 for IPv4LL and 2000000 for roaming interfaces.
511.It Ic mudurl Ar url
512Specifies the URL for a Manufacturer Usage Description (MUD).
513The description is used by upstream network devices to instantiate any
514desired access lists.
515See draft-ietf-opsawg-mud for more information.
516.It Ic noalias
517Any pre-existing IPv4 addresses will be removed from the interface when
518adding a new IPv4 address.
519.It Ic noarp
520Don't send any ARP requests.
521This also disables IPv4LL.
522.It Ic arp_persistdefence
523Keep the IP address even if defence fails upon IP Address conflict.
524.It Ic noauthrequired
525Don't require authentication even though we requested it.
526Also allows FORCERENEW and RECONFIGURE messages without authentication.
527.It Ic nodelay
528Don't delay for an initial randomised time when starting protocols.
529.It Ic nodev
530Don't load
531.Pa /dev
532management modules.
533.It Ic nodhcp
534Don't start DHCP or listen to DHCP messages.
535This is only useful when allowing IPv4LL.
536.It Ic nodhcp6
537Don't start DHCPv6 or listen to DHCPv6 messages.
538Normally DHCPv6 is started by an IPv6 Router Advertisement instruction or
539configuration.
540.It Ic nogateway
541Don't install any default routes.
542.It Ic gateway
543Install a default route if available (default).
544.It Ic nohook Ar script
545Don't run this hook script.
546Matches full name, or prefixed with 2 numbers optionally ending with
547.Pa .sh .
548.Pp
549So to stop
550.Nm dhcpcd
551from touching your DNS settings or starting wpa_supplicant you would do:-
552.D1 nohook resolv.conf, wpa_supplicant
553.It Ic noipv4
554Don't attempt to configure an IPv4 address.
555.It Ic noipv4ll
556Don't attempt to obtain an IPv4LL address if we failed to get one via DHCP.
557See
558.Rs
559.%T "RFC 3927"
560.Re
561.It Ic noipv6
562Don't solicit or accept IPv6 Router Advertisements and DHCPv6.
563.It Ic noipv6rs
564Don't solicit or accept IPv6 Router Advertisements.
565.It Ic nolink
566Don't receive link messages about carrier status.
567You should only set this for buggy interface drivers.
568.It Ic noup
569Don't bring the interface up when in manager mode.
570.It Ic option Ar option
571Requests the
572.Ar option
573from the server.
574It can be a variable to be used in
575.Xr dhcpcd-run-hooks 8
576or the numerical value.
577You can specify more
578.Ar option Ns s
579separated by commas, spaces or more
580.Ic option
581lines.
582Prepend dhcp6_ to
583.Ar option
584to request a DHCPv6 option.
585If no DHCPv6 options are configured,
586then DHCPv4 options are mapped to equivalent DHCPv6 options.
587.Pp
588Prepend nd_ to
589.Ar option
590to handle ND options, but this only works for the
591.Ic nooption ,
592.Ic reject
593and
594.Ic require
595options.
596.Pp
597To see a list of options you can use, call
598.Nm dhcpcd
599with the
600.Fl V , Fl Fl variables
601argument.
602.It Ic nooption Ar option
603Remove the option from the message before it's processed.
604.It Ic require Ar option
605Requires the
606.Ar option
607to be present in all messages, otherwise the message is ignored.
608To enforce that
609.Nm dhcpcd
610only responds to DHCP servers and not BOOTP servers, you can
611.Ic require
612.Ar dhcp_message_type .
613This isn't an exact science though because a BOOTP server can send DHCP-like
614options.
615.It Ic reject Ar option
616Reject a message that contains the
617.Ar option .
618This is useful when you cannot use
619.Ic require
620to select / de-select BOOTP messages.
621.It Ic destination Ar option
622If
623.Nm
624detects an address added to a point to point interface (PPP, TUN, etc) then
625it will set the listed DHCP options to the destination address of the
626interface.
627.It Ic profile Ar name
628Subsequent options are only parsed for this profile
629.Ar name .
630.It Ic quiet
631Suppress any dhcpcd output to the console, except for errors.
632.It Ic reboot Ar seconds
633Allow
634.Ar reboot
635seconds before moving to the DISCOVER phase if we have an old lease to use.
636Allow
637.Ar reboot
638seconds before starting fallback states from the DISCOVER phase.
639IPv4LL is started when the first
640.Ar reboot
641timeout is reached.
642The default is 5 seconds.
643A setting of 0 seconds causes
644.Nm
645to skip the reboot phase and go straight into DISCOVER.
646This is desirable for mobile users because if you change from network A to
647network B and they use the same subnet and the address from network A isn't
648in use on network B, then the DHCP server will remain silent even if
649authoritative which means
650.Nm dhcpcd
651will timeout before moving back to the DISCOVER phase.
652This has no effect on DHCPv6 other than skipping the reboot phase.
653.It Ic release
654.Nm dhcpcd
655will release the lease prior to stopping the interface.
656.It Ic script Ar script
657Use
658.Ar script
659instead of the default
660.Pa /libexec/dhcpcd-run-hooks .
661.It Ic request_time Ar seconds
662Request the lease for
663.Ar seconds
664before going back to DISCOVER.
665The default is 180 seconds.
666.It Ic ssid Ar ssid
667Subsequent options are only parsed for this wireless
668.Ar ssid .
669.It Ic slaac Ic hwaddr | Ic private | Ic token Ar token Op Ic temp | Ic temporary
670Selects the interface identifier used for SLAAC generated IPv6 addresses.
671If
672.Ic private
673is used, a RFC 7217 address is generated.
674If
675.Ic token Ar token
676is used then the token is combined with the prefix to make the final address.
677The
678.Ic temporary
679directive will create a temporary address for the prefix as well.
680.It Ic static Ar value
681Configures a static
682.Ar value .
683If you set
684.Ic ip_address
685then
686.Nm dhcpcd
687will not attempt to obtain a lease and will just use the value for the address
688with an infinite lease time.
689If you set an empty value this removes all prior static allocations to
690the same value.
691This is useful when using profiles and in the case of
692.Ic ip_address
693it will remove the static allocation.
694Note that setting 0.0.0.0 keeps the static allocation but waits for a 3rdparty
695to configure the address.
696If you set
697.Ic ip6_address ,
698.Nm dhcpcd
699will continue auto-configuration as normal.
700.Pp
701Here is an example which configures two static address, overriding the default
702IPv4 broadcast address, an IPv4 router, DNS and disables IPv6 auto-configuration.
703You could also use the
704.Ic inform6
705command here if you wished to obtain more information via DHCPv6.
706For IPv4, you should use the
707.Ic inform Ar ipaddress
708option instead of setting a static address.
709.D1 interface eth0
710.D1 noipv6rs
711.D1 static ip_address=192.168.0.10/24
712.D1 static broadcast_address=192.168.0.63
713.D1 static ip6_address=fd51:42f8:caae:d92e::ff/64
714.D1 static routers=192.168.0.1
715.D1 static domain_name_servers=192.168.0.1 fd51:42f8:caae:d92e::1
716.Pp
717Here is an example for PPP which gives the destination a default route.
718It uses the special
719.Ar destination
720keyword to insert the destination address
721into the value.
722.D1 interface ppp0
723.D1 static ip_address=0.0.0.0
724.D1 destination routers
725.It Ic timeout Ar seconds
726Time out after
727.Ar seconds ,
728instead of the default 30.
729A setting of 0
730.Ar seconds
731causes
732.Nm dhcpcd
733to wait forever to get a lease.
734If
735.Nm dhcpcd
736is working on a single interface then
737.Nm dhcpcd
738will exit when a timeout occurs, otherwise
739.Nm dhcpcd
740will fork into the background.
741If using IPv4LL then
742.Nm dhcpcd
743start the IPv4LL process after the timeout and then wait a little longer
744before really timing out.
745.It Ic userclass Ar string
746Tag the DHCPv4 message with the userclass.
747You can specify more than one.
748.It Ic msuserclass Ar string
749Tag the DHCPv4 mesasge with the Microsoft userclass.
750Unlike the
751.Ic userclass
752option, this one can only be added once.
753It should only be used for Microsoft DHCP servers and the
754.Ic vendorclassid
755should be set to "MSFT 98" or "MSFT 5.0".
756This option is not RFC compliant.
757.It Ic vendor Ar code , Ns Ar value
758Add an encapsulated vendor option.
759.Ar code
760should be between 1 and 254 inclusive.
761To add a raw vendor string, omit
762.Ar code
763but keep the comma.
764Examples.
765.Pp
766Set the vendor option 01 with an IP address.
767.D1 vendor 01,192.168.0.2
768Set the vendor option 02 with a hex code.
769.D1 vendor 02,01:02:03:04:05
770Set the vendor option 03 with an IP address as a string.
771.D1 vendor 03,\e"192.168.0.2\e"
772Set un-encapsulated vendor option to hello world.
773.D1 vendor ,"hello world"
774.It Ic vendorclassid Ar string
775Set the DHCP Vendor Class.
776DHCPv6 has its own option as shown below.
777The default is
778dhcpcd-<version>:<os>:<machine>:<platform>.
779For example
780.D1 dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386
781If not set then none is sent.
782Some badly configured DHCP servers reject unknown vendorclassids.
783To work around it, try and impersonate Windows by using the MSFT vendorclassid.
784.It Ic vendclass Ar en Ar data
785Add the DHCPv6 Vendor Indetifying Vendor Class with the IANA assigned Enterprise
786Number
787.Ar en
788with the
789.Ar data .
790This option can be set more than once to add more data, but the behaviour,
791as per RFC 3925 is undefined if the Enterprise Number differs.
792.It Ic waitip Op 4 | 6
793Wait for an address to be assigned before forking to the background.
7944 means wait for an IPv4 address to be assigned.
7956 means wait for an IPv6 address to be assigned.
796If no argument is given,
797.Nm
798will wait for any address protocol to be assigned.
799It is possible to wait for more than one address protocol and
800.Nm
801will only fork to the background when all waiting conditions are satisfied.
802.It Ic xidhwaddr
803Use the last four bytes of the hardware address as the DHCP xid instead
804of a randomly generated number.
805.El
806.Ss Defining new options
807DHCP, ND and DHCPv6 allow for the use of custom options, and RFC 3925 vendor
808options for DHCP can also be supplied.
809Each option needs to be started with the
810.Ic define ,
811.Ic definend ,
812.Ic define6
813or
814.Ic vendopt
815directive.
816This can optionally be followed by both
817.Ic embed
818or
819.Ic encap
820options.
821Both can be specified more than once and
822.Ic embed
823must come before
824.Ic encap .
825.Bl -tag -width indent
826.It Ic define Ar code Ar type Ar variable
827Defines the DHCP option
828.Ar code
829of
830.Ar type
831with a name of
832.Ar variable
833exported to
834.Xr dhcpcd-run-hooks 8 .
835.It Ic definend Ar code Ar type Ar variable
836Defines the ND option
837.Ar code
838of
839.Ar type
840with a name of
841.Ar variable
842exported to
843.Xr dhcpcd-run-hooks 8 ,
844with a prefix of
845.Va nd_ .
846.It Ic define6 Ar code Ar type Ar variable
847Defines the DHCPv6 option
848.Ar code
849of
850.Ar type
851with a name of
852.Ar variable
853exported to
854.Xr dhcpcd-run-hooks 8 ,
855with a prefix of
856.Va dhcp6_ .
857.It Ic vendopt Ar code Ar type Ar variable
858Defines the Vendor-Identifying Vendor Options.
859The
860.Ar code
861is the IANA Enterprise Number which will uniquely describe the encapsulated
862options.
863.Ar type
864is normally
865.Ar encap .
866.Ar variable
867names the Vendor option to be exported.
868.It Ic embed Ar type Ar variable
869Defines an embedded variable within the defined option.
870The length is determined by the
871.Ar type .
872If the
873.Ar variable
874is not the same as defined in the parent option,
875it is prefixed with the parent
876.Ar variable
877first with an underscore.
878If the
879.Ar variable
880has the name of
881.Ar reserved
882then it is not processed.
883.It Ic encap Ar code Ar type Ar variable
884Defines an encapsulated variable within the defined option.
885The length is determined by the
886.Ar type .
887If the
888.Ar variable
889is not the same as defined in the parent option,
890it is prefixed with the parent
891.Ar variable
892first with an underscore.
893.El
894.Ss Type prefix
895These keywords come before the type itself, to describe it more fully.
896You can use more than one, but they must appear in the order listed below.
897.Bl -tag -width -indent
898.It Ic request
899Requests the option by default without having to be specified in user
900configuration.
901.It Ic norequest
902This option cannot be requested, regardless of user configuration.
903.It Ic optional
904This option is optional.
905Only makes sense for embedded options like the client FQDN option, where
906the FQDN string itself is optional.
907.It Ic index
908The option can appear more than once and will be indexed.
909.It Ic array
910The option data is split into a space separated array, each element being
911the same type.
912.El
913.Ss Types to define
914The type directly affects the length of data consumed inside the option.
915Any remaining data is normally discarded.
916Lengths can be specified for string and binhex types, but this is generally
917with other data embedded afterwards in the same option.
918.Bl -tag -width indent
919.It Ic ipaddress
920An IPv4 address, 4 bytes.
921.It Ic ip6address
922An IPv6 address, 16 bytes.
923.It Ic string Op : Ic length
924A NVT ASCII string of printable characters.
925.It Ic byte
926A byte.
927.It Ic bitflags : Ic flags
928A byte represented as a string of flags, most significant bit first.
929For example, using ABCDEFGH then A would equal 10000000, B 01000000,
930C 00100000, etc.
931If the bit is not set, the flag is not printed.
932A flag of 0 is not printed even if the bit position is set.
933This is to allow reservation of the first bits while assigning the last bits.
934.It Ic int16
935A signed 16bit integer, 2 bytes.
936.It Ic uint16
937An unsigned 16bit integer, 2 bytes.
938.It Ic int32
939A signed 32bit integer, 4 bytes.
940.It Ic uint32
941An unsigned 32bit integer, 4 bytes.
942.It Ic flag
943A fixed value (1) to indicate that the option is present, 0 bytes.
944.It Ic domain
945An RFC 3397 encoded string.
946.It Ic dname
947An RFC 1035 validated string.
948.It Ic uri
949If an array then the first two bytes are the URI length inside the option data.
950Otherwise, the whole option data is the URI.
951As a space is not allowed in the URI encoding, the URIs are space separated.
952.It Ic binhex Op : Ic length
953Binary data expressed as hexadecimal.
954.It Ic embed
955Contains embedded options (implies encap as well).
956.It Ic encap
957Contains encapsulated options (implies embed as well).
958.It Ic option
959References an option from the global definition.
960.El
961.Ss Example definition
962.D1 # DHCP option 81, Fully Qualified Domain Name, RFC 4702
963.D1 define 81 embed fqdn
964.D1 embed byte flags
965.D1 embed byte rcode1
966.D1 embed byte rcode2
967.D1 embed domain fqdn
968.Pp
969.D1 # DHCP option 125, Vendor Specific Information Option, RFC 3925
970.D1 define 125 encap vsio
971.D1 embed uint32 enterprise_number
972.D1 # Options defined for the enterprise number
973.D1 encap 1 ipaddress ipaddress
974.Ss Supported Authentication Protocols
975.Bl -tag -width -indent
976.It Ic token
977Sends a plain text token the server expects and matches a token sent by
978the server.
979The tokens do not have to be the same.
980If unspecified, the token with a
981.Ar secretid
982of 0 will be used in sending messages
983and validating received messages.
984.It Ic delayedrealm
985Delayed Authentication.
986.Nm dhcpcd
987will send an authentication option with no key or MAC.
988The server will see this option, and select a key for
989.Nm , writing the
990.Ar realm
991and
992.Ar secretid
993in it.
994.Nm dhcpcd
995will then look for an unexpired token with a matching
996.Ar realm
997and
998.Ar secretid .
999This token is used to authenticate all other messages.
1000.It Ic delayed
1001Same as above, but without a realm.
1002.El
1003.Ss Supported Authentication Algorithms
1004If none specified,
1005.Ic hmac-md5
1006is the default.
1007.Bl -tag -width -indent
1008.It Ic hmac-md5
1009.El
1010.Ss Supported Replay Detection Mechanisms
1011If none specified,
1012.Ic monotonic
1013is the default.
1014If this is changed from what was previously used,
1015or the means of calculating or storing it is broken, then the DHCP server
1016will probably have to have its notion of the client's Replay Detection Value
1017reset.
1018.Bl -tag -width -indent
1019.It Ic monocounter
1020Read the number in the file
1021.Pa /var/db/dhcpcd/dhcpcd-rdm.monotonic
1022and add one to it.
1023.It Ic monotime
1024Create an NTP timestamp from the system time.
1025.It Ic monotonic
1026Same as
1027.Ic monotime .
1028.El
1029.Sh SEE ALSO
1030.Xr fnmatch 3 ,
1031.Xr if_nametoindex 3 ,
1032.Xr dhcpcd 8 ,
1033.Xr dhcpcd-run-hooks 8
1034.Sh AUTHORS
1035.An Roy Marples Aq Mt roy@marples.name
1036.Sh BUGS
1037Please report them to
1038.Lk https://roy.marples.name/projects/dhcpcd
1039