dhclient - Fix typo.
[dragonfly.git] / sbin / dhclient / dhclient.conf.5
1 .\" $OpenBSD: src/sbin/dhclient/dhclient.conf.5,v 1.16 2008/10/05 13:24:40 krw Exp $
2 .\"
3 .\" Copyright (c) 1997 The Internet Software Consortium.
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 .\"
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of The Internet Software Consortium nor the names
16 .\"    of its contributors may be used to endorse or promote products derived
17 .\"    from this software without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
20 .\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 .\" DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
24 .\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\" This software has been written for the Internet Software Consortium
34 .\" by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
35 .\" Enterprises.  To learn more about the Internet Software Consortium,
36 .\" see ``http://www.isc.org/isc''.  To learn more about Vixie
37 .\" Enterprises, see ``http://www.vix.com''.
38 .\"
39 .Dd July 31, 2012
40 .Dt DHCLIENT.CONF 5
41 .Os
42 .Sh NAME
43 .Nm dhclient.conf
44 .Nd DHCP client configuration file
45 .Sh DESCRIPTION
46 The
47 .Nm
48 file contains configuration information for
49 .Xr dhclient 8 ,
50 the Internet Software Consortium DHCP Client.
51 .Pp
52 The
53 .Nm
54 file is a free-form ASCII text file.
55 It is parsed by the recursive-descent parser built into
56 .Xr dhclient 8 .
57 The file may contain extra tabs and newlines for formatting purposes.
58 Keywords in the file are case-insensitive.
59 Comments may be placed anywhere within the file (except within quotes).
60 Comments begin with the
61 .Sq #
62 character and end at the end of the line.
63 .Pp
64 The
65 .Nm
66 file can be used to configure the behaviour of the client in a wide variety
67 of ways: protocol timing, information requested from the server, information
68 required of the server, defaults to use if the server does not provide
69 certain information, values with which to override information provided by
70 the server, or values to prepend or append to information provided by the
71 server.
72 The configuration file can also be preinitialized with addresses to
73 use on networks that don't have DHCP servers.
74 .Sh PROTOCOL TIMING
75 The timing behaviour of the client need not be configured by the user.
76 If no timing configuration is provided by the user, a fairly
77 reasonable timing behaviour will be used by default \- one which
78 results in fairly timely updates without placing an inordinate load on
79 the server.
80 .Pp
81 The following statements can be used to adjust the timing behaviour of
82 the DHCP client if required, however:
83 .Bl -tag -width Ds
84 .It Ic timeout Ar time ;
85 The
86 .Ic timeout
87 statement determines the amount of time that must pass between the
88 time that the client begins to try to determine its address and the
89 time that it decides that it's not going to be able to contact a server.
90 By default, this timeout is sixty seconds.
91 After the timeout has passed, if there are any static leases defined in the
92 configuration file, or any leases remaining in the lease database that
93 have not yet expired, the client will loop through these leases
94 attempting to validate them, and if it finds one that appears to be
95 valid, it will use that lease's address.
96 If there are no valid static leases or unexpired leases in the lease database,
97 the client will restart the protocol after the defined retry interval.
98 .It Ic retry Ar time ;
99 The
100 .Ic retry
101 statement determines the time that must pass after the client has
102 determined that there is no DHCP server present before it tries again
103 to contact a DHCP server.
104 By default, this is five minutes.
105 .It Ic select-timeout Ar time ;
106 It is possible (some might say desirable) for there to be more than
107 one DHCP server serving any given network.
108 In this case, it is possible that a client may be sent more than one offer
109 in response to its initial lease discovery message.
110 It may be that one of these offers is preferable to the other
111 (e.g., one offer may have the address the client previously used,
112 and the other may not).
113 .Pp
114 The
115 .Ic select-timeout
116 is the time after the client sends its first lease discovery request
117 at which it stops waiting for offers from servers, assuming that it
118 has received at least one such offer.
119 If no offers have been received by the time the
120 .Ic select-timeout
121 has expired, the client will accept the first offer that arrives.
122 .Pp
123 By default, the
124 .Ic select-timeout
125 is zero seconds \- that is, the client will take the first offer it sees.
126 .It Ic reboot Ar time ;
127 When the client is restarted, it first tries to reacquire the last
128 address it had.
129 This is called the INIT-REBOOT state.
130 If it is still attached to the same network it was attached to when it last
131 ran, this is the quickest way to get started.
132 The
133 .Ic reboot
134 statement sets the time that must elapse after the client first tries
135 to reacquire its old address before it gives up and tries to discover
136 a new address.
137 By default, the reboot timeout is ten seconds.
138 .It Ic backoff-cutoff Ar time ;
139 The client uses an exponential backoff algorithm with some randomness,
140 so that if many clients try to configure themselves at the same time,
141 they will not make their requests in lockstep.
142 The
143 .Ic backoff-cutoff
144 statement determines the maximum amount of time that the client is
145 allowed to back off.
146 It defaults to 15 seconds.
147 .It Ic initial-interval Ar time ;
148 The
149 .Ic initial-interval
150 statement sets the amount of time between the first attempt to reach a
151 server and the second attempt to reach a server.
152 Each time a message is sent, the interval between messages is incremented by
153 twice the current interval multiplied by a random number between zero and one.
154 If it is greater than the backoff-cutoff amount, it is set to that
155 amount.
156 It defaults to ten seconds.
157 .It Ic link-timeout Ar time ;
158 The
159 .Ic link-timeout
160 statement sets the amount of time to wait for an interface link before timing
161 out.
162 The default value is 10 seconds, but the special value 0 requests that dhclient
163 not wait for a link state change before timing out.
164 .El
165 .Sh LEASE REQUIREMENTS AND REQUESTS
166 The DHCP protocol allows the client to request that the server send it
167 specific information, and not send it other information that it is not
168 prepared to accept.
169 The protocol also allows the client to reject offers from servers if they
170 don't contain information the client needs, or if the information provided
171 is not satisfactory.
172 .Pp
173 There is a variety of data contained in offers that DHCP servers send
174 to DHCP clients.
175 The data that can be specifically requested is what are called
176 .Em DHCP Options .
177 DHCP Options are defined in
178 .Xr dhcp-options 5 .
179 .Bl -tag -width Ds
180 .It Xo
181 .Ic request Op Ar option
182 .Oo , Ar ... option Oc ;
183 .Xc
184 The
185 .Ic request
186 statement causes the client to request that any server responding to the
187 client send the client its values for the specified options.
188 Only the option names should be specified in the request statement \- not
189 option parameters.
190 .It Xo
191 .Ic require Op Ar option
192 .Oo , Ar ... option Oc ;
193 .Xc
194 The
195 .Ic require
196 statement lists options that must be sent in order for an offer to be accepted.
197 Offers that do not contain all the listed options will be ignored.
198 .It Xo
199 .Ic send No { Op Ar option declaration
200 .Oo , Ar ... option declaration Oc }
201 .Xc
202 The
203 .Ic send
204 statement causes the client to send the specified options to the server with
205 the specified values.
206 These are full option declarations as described in
207 .Xr dhcp-options 5 .
208 Options that are always sent in the DHCP protocol should not be specified
209 here.
210 One use for this statement is to send information to the server
211 that will allow it to differentiate between this client and other
212 clients or kinds of clients.
213 .El
214 .Sh OPTION MODIFIERS
215 Options in the lease can be modified before being passed to the client
216 configuration script,
217 .Xr dhclient-script 5 .
218 .Pp
219 The default
220 .Xr dhclient-script 5
221 processes only options 1 (subnet
222 mask), 3 (routers), 6 (domain name servers), 15 (domain-name), and 33
223 (static routes).
224 Use of option modifiers on other options will have no effect unless
225 .Xr dhclient-script 5
226 is modified.
227 .Pp
228 Several option modifiers are available.
229 .Bl -tag -width Ds
230 .It Xo
231 .Ic default No { Op Ar option declaration
232 .Oo , Ar ... option declaration Oc }
233 .Xc
234 If for some set of options the client should use the value supplied by
235 the server, but needs to use some default value if no value was supplied
236 by the server, these values can be defined in the
237 .Ic default
238 statement.
239 .It Xo
240 .Ic supersede No { Op Ar option declaration
241 .Oo , Ar ... option declaration Oc }
242 .Xc
243 If for some set of options the client should always use its own value
244 rather than any value supplied by the server, these values can be defined
245 in the
246 .Ic supersede
247 statement.
248 .It Xo
249 .Ic prepend No { Op Ar option declaration
250 .Oo , Ar ... option declaration Oc }
251 .Xc
252 If for some set of options the client should use a value you supply,
253 and then use the values supplied by the server, if any,
254 these values can be defined in the
255 .Ic prepend
256 statement.
257 The
258 .Ic prepend
259 statement can only be used for options which allow more than one value to
260 be given.
261 This restriction is not enforced \- if violated, the results are unpredictable.
262 .It Xo
263 .Ic append No { Op Ar option declaration
264 .Oo , Ar ... option declaration Oc }
265 .Xc
266 If for some set of options the client should first use the values
267 supplied by the server, if any, and then use values you supply, these
268 values can be defined in the
269 .Ic append
270 statement.
271 The
272 .Ic append
273 statement can only be used for options which allow more than one value to
274 be given.
275 This restriction is not enforced \- if you ignore it,
276 the behaviour will be unpredictable.
277 .El
278 .Sh LEASE DECLARATIONS
279 The lease declaration:
280 .Pp
281 .D1 Ic lease No { Ar lease-declaration Oo Ar ... lease-declaration Oc }
282 .Pp
283 The DHCP client may decide after some period of time (see
284 .Sx PROTOCOL TIMING )
285 that it is not going to succeed in contacting a server.
286 At that time, it consults its own database of old leases and tests each one
287 that has not yet timed out by pinging the listed router for that lease to
288 see if that lease could work.
289 It is possible to define one or more
290 .Em fixed
291 leases in the client configuration file for networks where there is no DHCP
292 or BOOTP service, so that the client can still automatically configure its
293 address.
294 This is done with the
295 .Ic lease
296 statement.
297 .Pp
298 NOTE: the lease statement is also used in the
299 .Pa dhclient.leases
300 file in order to record leases that have been received from DHCP servers.
301 Some of the syntax for leases as described below is only needed in the
302 .Pa dhclient.leases
303 file.
304 Such syntax is documented here for completeness.
305 .Pp
306 A lease statement consists of the lease keyword, followed by a left
307 curly brace, followed by one or more lease declaration statements,
308 followed by a right curly brace.
309 The following lease declarations are possible:
310 .Bl -tag -width Ds
311 .It Ic bootp ;
312 The
313 .Ic bootp
314 statement is used to indicate that the lease was acquired using the
315 BOOTP protocol rather than the DHCP protocol.
316 It is never necessary to specify this in the client configuration file.
317 The client uses this syntax in its lease database file.
318 .It Ic interface Ar \&"string\&" ;
319 The
320 .Ic interface
321 lease statement is used to indicate the interface on which the lease is valid.
322 If set, this lease will only be tried on a particular interface.
323 When the client receives a lease from a server, it always records the
324 interface number on which it received that lease.
325 If predefined leases are specified in the
326 .Nm
327 file, the interface should also be specified, although this is not required.
328 .It Ic fixed-address Ar ip-address ;
329 The
330 .Ic fixed-address
331 statement is used to set the IP address of a particular lease.
332 This is required for all lease statements.
333 The IP address must be specified as a dotted quad (e.g., 12.34.56.78).
334 .It Ic filename Ar \&"string\&" ;
335 The
336 .Ic filename
337 statement specifies the name of the boot filename to use.
338 This is not used by the standard client configuration script, but is
339 included for completeness.
340 .It Ic server-name Ar \&"string\&" ;
341 The
342 .Ic server-name
343 statement specifies the name of the boot server name to use.
344 This is also not used by the standard client configuration script.
345 .It Ic option Ar option-declaration ;
346 The
347 .Ic option
348 statement is used to specify the value of an option supplied by the server,
349 or, in the case of predefined leases declared in
350 .Nm ,
351 the value that the user wishes the client configuration script to use if the
352 predefined lease is used.
353 .It Ic medium Ar \&"media setup\&" ;
354 The
355 .Ic medium
356 statement can be used on systems where network interfaces cannot
357 automatically determine the type of network to which they are connected.
358 The media setup string is a system-dependent parameter which is passed
359 to the DHCP client configuration script when initializing the interface.
360 On
361 .Ux
362 and UNIX-like systems, the argument is passed on the ifconfig command line
363 when configuring the interface.
364 .Pp
365 The DHCP client automatically declares this parameter if it used a
366 media type (see the
367 .Ic media
368 statement) when configuring the interface in order to obtain a lease.
369 This statement should be used in predefined leases only if the network
370 interface requires media type configuration.
371 .It Ic renew Ar date ;
372 .It Ic rebind Ar date ;
373 .It Ic expire Ar date ;
374 The
375 .Ic renew
376 statement defines the time at which the DHCP client should begin trying to
377 contact its server to renew a lease that it is using.
378 The
379 .Ic rebind
380 statement defines the time at which the DHCP client should begin to try to
381 contact
382 .Em any
383 DHCP server in order to renew its lease.
384 The
385 .Ic expire
386 statement defines the time at which the DHCP client must stop using a lease
387 if it has not been able to contact a server in order to renew it.
388 .El
389 .Pp
390 These declarations are automatically set in leases acquired by the
391 DHCP client, but must also be configured in predefined leases \- a
392 predefined lease whose expiry time has passed will not be used by the
393 DHCP client.
394 .Pp
395 Dates are specified as follows:
396 .Bd -ragged -offset indent
397 .Ar <weekday>
398 .Sm off
399 .Ar <year> No / Ar <month> No / Ar <day>
400 .Ar <hour> : <minute> : <second>
401 .Sm on
402 .Ed
403 .Pp
404 The weekday is present to make it easy for a human to tell when a
405 lease expires \- it's specified as a number from zero to six, with zero
406 being Sunday.
407 When declaring a predefined lease, it can always be specified as zero.
408 The year is specified with the century, so it should generally be four
409 digits except for really long leases.
410 The month is specified as a number starting with 1 for January.
411 The day of the month is likewise specified starting with 1.
412 The hour is a number between 0 and 23,
413 the minute a number between 0 and 59,
414 and the second also a number between 0 and 59.
415 .Sh ALIAS DECLARATIONS
416 .Ic alias No { Ar declarations ... No }
417 .Pp
418 Some DHCP clients running TCP/IP roaming protocols may require that in
419 addition to the lease they may acquire via DHCP, their interface also
420 be configured with a predefined IP alias so that they can have a
421 permanent IP address even while roaming.
422 The Internet Software Consortium DHCP client doesn't support roaming with
423 fixed addresses directly, but in order to facilitate such experimentation,
424 the DHCP client can be set up to configure an IP alias using the
425 .Ic alias
426 declaration.
427 .Pp
428 The
429 .Ic alias
430 declaration resembles a lease declaration, except that options other than
431 the subnet-mask option are ignored by the standard client configuration
432 script, and expiry times are ignored.
433 A typical alias declaration includes an interface declaration, a fixed-address
434 declaration for the IP alias address, and a subnet-mask option declaration.
435 A medium statement should never be included in an alias declaration.
436 .Sh OTHER DECLARATIONS
437 .Bl -tag -width Ds
438 .It Ic reject Ar ip-address ;
439 The
440 .Ic reject
441 statement causes the DHCP client to reject offers from servers who use
442 the specified address as a server identifier.
443 This can be used to avoid being configured by rogue or misconfigured DHCP
444 servers, although it should be a last resort \- better to track down
445 the bad DHCP server and fix it.
446 .It Xo
447 .Ic interface Ar \&"name\&" No { Ar declarations
448 .Ar ... No }
449 .Xc
450 A client with more than one network interface may require different
451 behaviour depending on which interface is being configured.
452 All timing parameters and declarations other than lease and alias
453 declarations can be enclosed in an interface declaration, and those
454 parameters will then be used only for the interface that matches the
455 specified name.
456 Interfaces for which there is no interface declaration will use the
457 parameters declared outside of any interface declaration,
458 or the default settings.
459 .It Xo
460 .Ic media Ar \&"media setup\&"
461 .Oo , Ar \&"media setup\&" , ... Oc ;
462 .Xc
463 The
464 .Ic media
465 statement defines one or more media configuration parameters which may
466 be tried while attempting to acquire an IP address.
467 The DHCP client will cycle through each media setup string on the list,
468 configuring the interface using that setup and attempting to boot,
469 and then trying the next one.
470 This can be used for network interfaces which aren't capable of sensing
471 the media type unaided \- whichever media type succeeds in getting a request
472 to the server and hearing the reply is probably right (no guarantees).
473 .Pp
474 The media setup is only used for the initial phase of address
475 acquisition (the DHCPDISCOVER and DHCPOFFER packets).
476 Once an address has been acquired, the DHCP client will record it in its
477 lease database and will record the media type used to acquire the address.
478 Whenever the client tries to renew the lease, it will use that same media type.
479 The lease must expire before the client will go back to cycling through media
480 types.
481 .It Ic script Ar \&"script-name\&" ;
482 The
483 .Ic script
484 statement is used to specify the pathname of the DHCP client configuration
485 script.
486 This script is used by the DHCP client to set each interface's initial
487 configuration prior to requesting an address, to test the address once it
488 has been offered, and to set the interface's final configuration once a
489 lease has been acquired.
490 If no lease is acquired, the script is used to test predefined leases, if
491 any, and also called once if no valid lease can be identified.
492 For more information, see
493 .Xr dhclient.leases 5 .
494 .El
495 .Sh EXAMPLES
496 The following configuration file is used on a laptop
497 which has an IP alias of 192.5.5.213, and has one interface,
498 ep0 (a 3Com 3C589C).
499 Booting intervals have been shortened somewhat from the default, because
500 the client is known to spend most of its time on networks with little DHCP
501 activity.
502 The laptop does roam to multiple networks.
503 .Bd -literal -offset indent
504 timeout 60;
505 retry 60;
506 reboot 10;
507 select-timeout 5;
508 initial-interval 2;
509 reject 192.33.137.209;
510
511 interface "ep0" {
512     send host-name "andare.fugue.com";
513     send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
514     send dhcp-lease-time 3600;
515     supersede domain-name "fugue.com rc.vix.com home.vix.com";
516     prepend domain-name-servers 127.0.0.1;
517     request subnet-mask, broadcast-address, time-offset, routers,
518             domain-name, domain-name-servers, host-name;
519     require subnet-mask, domain-name-servers;
520     script "/etc/dhclient-script";
521     media "media 10baseT/UTP", "media 10base2/BNC";
522 }
523
524 alias {
525   interface "ep0";
526   fixed-address 192.5.5.213;
527   option subnet-mask 255.255.255.255;
528 }
529 .Ed
530 .Pp
531 This is a very complicated
532 .Nm
533 file \- in general, yours should be much simpler.
534 In many cases, it's sufficient to just create an empty
535 .Nm
536 file \- the defaults are usually fine.
537 .Sh SEE ALSO
538 .Xr dhclient.leases 5 ,
539 .Xr dhclient-script 5 ,
540 .Xr dhcp-options 5 ,
541 .Xr dhcpd.conf 5 Pq Pa pkgsrc/net/isc-dhcpd4 ,
542 .Xr dhclient 8 ,
543 .Xr dhcpd 8 Pq Pa pkgsrc/net/isc-dhcpd4
544 .Pp
545 RFC 2132, RFC 2131.
546 .Sh AUTHORS
547 .An -nosplit
548 .Xr dhclient 8
549 was written by
550 .An Ted Lemon Aq mellon@vix.com
551 under a contract with Vixie Labs.
552 .Pp
553 The current implementation was reworked by
554 .An Henning Brauer Aq henning@openbsd.org .