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