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