e02c9ff09d48289db10050ca1e341203949cde5f
[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.2 2008/08/30 20:52:00 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 .Xo
275 .Ic \   \& lease No { Ar lease-declaration
276 .Oo Ar ... lease-declaration Oc }
277 .Xc
278 .Pp
279 The DHCP client may decide after some period of time (see
280 .Sx PROTOCOL TIMING )
281 that it is not going to succeed in contacting a server.
282 At that time, it consults its own database of old leases and tests each one
283 that has not yet timed out by pinging the listed router for that lease to
284 see if that lease could work.
285 It is possible to define one or more
286 .Em fixed
287 leases in the client configuration file for networks where there is no DHCP
288 or BOOTP service, so that the client can still automatically configure its
289 address.
290 This is done with the
291 .Ic lease
292 statement.
293 .Pp
294 NOTE: the lease statement is also used in the
295 .Pa dhclient.leases
296 file in order to record leases that have been received from DHCP servers.
297 Some of the syntax for leases as described below is only needed in the
298 .Pa dhclient.leases
299 file.
300 Such syntax is documented here for completeness.
301 .Pp
302 A lease statement consists of the lease keyword, followed by a left
303 curly brace, followed by one or more lease declaration statements,
304 followed by a right curly brace.
305 The following lease declarations are possible:
306 .Bl -tag -width Ds
307 .It Ic bootp ;
308 The
309 .Ic bootp
310 statement is used to indicate that the lease was acquired using the
311 BOOTP protocol rather than the DHCP protocol.
312 It is never necessary to specify this in the client configuration file.
313 The client uses this syntax in its lease database file.
314 .It Ic interface Ar \&"string\&" ;
315 The
316 .Ic interface
317 lease statement is used to indicate the interface on which the lease is valid.
318 If set, this lease will only be tried on a particular interface.
319 When the client receives a lease from a server, it always records the
320 interface number on which it received that lease.
321 If predefined leases are specified in the
322 .Nm
323 file, the interface should also be specified, although this is not required.
324 .It Ic fixed-address Ar ip-address ;
325 The
326 .Ic fixed-address
327 statement is used to set the IP address of a particular lease.
328 This is required for all lease statements.
329 The IP address must be specified as a dotted quad (e.g., 12.34.56.78).
330 .It Ic filename Ar \&"string\&" ;
331 The
332 .Ic filename
333 statement specifies the name of the boot filename to use.
334 This is not used by the standard client configuration script, but is
335 included for completeness.
336 .It Ic server-name Ar \&"string\&" ;
337 The
338 .Ic server-name
339 statement specifies the name of the boot server name to use.
340 This is also not used by the standard client configuration script.
341 .It Ic option Ar option-declaration ;
342 The
343 .Ic option
344 statement is used to specify the value of an option supplied by the server,
345 or, in the case of predefined leases declared in
346 .Nm dhclient.conf ,
347 the value that the user wishes the client configuration script to use if the
348 predefined lease is used.
349 .It Ic medium Ar \&"media setup\&" ;
350 The
351 .Ic medium
352 statement can be used on systems where network interfaces cannot
353 automatically determine the type of network to which they are connected.
354 The media setup string is a system-dependent parameter which is passed
355 to the DHCP client configuration script when initializing the interface.
356 On
357 .Ux
358 and UNIX-like systems, the argument is passed on the ifconfig command line
359 when configuring the interface.
360 .Pp
361 The DHCP client automatically declares this parameter if it used a
362 media type (see the
363 .Ic media
364 statement) when configuring the interface in order to obtain a lease.
365 This statement should be used in predefined leases only if the network
366 interface requires media type configuration.
367 .It Ic renew Ar date ;
368 .It Ic rebind Ar date ;
369 .It Ic expire Ar date ;
370 The
371 .Ic renew
372 statement defines the time at which the DHCP client should begin trying to
373 contact its server to renew a lease that it is using.
374 The
375 .Ic rebind
376 statement defines the time at which the DHCP client should begin to try to
377 contact
378 .Em any
379 DHCP server in order to renew its lease.
380 The
381 .Ic expire
382 statement defines the time at which the DHCP client must stop using a lease
383 if it has not been able to contact a server in order to renew it.
384 .El
385 .Pp
386 These declarations are automatically set in leases acquired by the
387 DHCP client, but must also be configured in predefined leases \- a
388 predefined lease whose expiry time has passed will not be used by the
389 DHCP client.
390 .Pp
391 Dates are specified as follows:
392 .Pp
393 .Ar \   \&<weekday>
394 .Sm off
395 .Ar <year> No / Ar <month> No / Ar <day>
396 .Ar <hour> : <minute> : <second>
397 .Sm on
398 .Pp
399 The weekday is present to make it easy for a human to tell when a
400 lease expires \- it's specified as a number from zero to six, with zero
401 being Sunday.
402 When declaring a predefined lease, it can always be specified as zero.
403 The year is specified with the century, so it should generally be four
404 digits except for really long leases.
405 The month is specified as a number starting with 1 for January.
406 The day of the month is likewise specified starting with 1.
407 The hour is a number between 0 and 23,
408 the minute a number between 0 and 59,
409 and the second also a number between 0 and 59.
410 .Sh ALIAS DECLARATIONS
411 .Ic alias No { Ar declarations ... No }
412 .Pp
413 Some DHCP clients running TCP/IP roaming protocols may require that in
414 addition to the lease they may acquire via DHCP, their interface also
415 be configured with a predefined IP alias so that they can have a
416 permanent IP address even while roaming.
417 The Internet Software Consortium DHCP client doesn't support roaming with
418 fixed addresses directly, but in order to facilitate such experimentation,
419 the DHCP client can be set up to configure an IP alias using the
420 .Ic alias
421 declaration.
422 .Pp
423 The
424 .Ic alias
425 declaration resembles a lease declaration, except that options other than
426 the subnet-mask option are ignored by the standard client configuration
427 script, and expiry times are ignored.
428 A typical alias declaration includes an interface declaration, a fixed-address
429 declaration for the IP alias address, and a subnet-mask option declaration.
430 A medium statement should never be included in an alias declaration.
431 .Sh OTHER DECLARATIONS
432 .Bl -tag -width Ds
433 .It Ic reject Ar ip-address ;
434 The
435 .Ic reject
436 statement causes the DHCP client to reject offers from servers who use
437 the specified address as a server identifier.
438 This can be used to avoid being configured by rogue or misconfigured DHCP
439 servers, although it should be a last resort \- better to track down
440 the bad DHCP server and fix it.
441 .It Xo
442 .Ic interface Ar \&"name\&" No { Ar declarations
443 .Ar ... No }
444 .Xc
445 A client with more than one network interface may require different
446 behaviour depending on which interface is being configured.
447 All timing parameters and declarations other than lease and alias
448 declarations can be enclosed in an interface declaration, and those
449 parameters will then be used only for the interface that matches the
450 specified name.
451 Interfaces for which there is no interface declaration will use the
452 parameters declared outside of any interface declaration,
453 or the default settings.
454 .It Xo
455 .Ic media Ar \&"media setup\&"
456 .Oo , Ar \&"media setup\&" , ... Oc ;
457 .Xc
458 The
459 .Ic media
460 statement defines one or more media configuration parameters which may
461 be tried while attempting to acquire an IP address.
462 The DHCP client will cycle through each media setup string on the list,
463 configuring the interface using that setup and attempting to boot,
464 and then trying the next one.
465 This can be used for network interfaces which aren't capable of sensing
466 the media type unaided \- whichever media type succeeds in getting a request
467 to the server and hearing the reply is probably right (no guarantees).
468 .Pp
469 The media setup is only used for the initial phase of address
470 acquisition (the DHCPDISCOVER and DHCPOFFER packets).
471 Once an address has been acquired, the DHCP client will record it in its
472 lease database and will record the media type used to acquire the address.
473 Whenever the client tries to renew the lease, it will use that same media type.
474 The lease must expire before the client will go back to cycling through media
475 types.
476 .It Ic script Ar \&"script-name\&" ;
477 The
478 .Ic script
479 statement is used to specify the pathname of the DHCP client configuration
480 script.
481 This script is used by the DHCP client to set each interface's initial
482 configuration prior to requesting an address, to test the address once it
483 has been offered, and to set the interface's final configuration once a
484 lease has been acquired.
485 If no lease is acquired, the script is used to test predefined leases, if
486 any, and also called once if no valid lease can be identified.
487 For more information, see
488 .Xr dhclient.leases 5 .
489 .El
490 .Sh EXAMPLES
491 The following configuration file is used on a laptop
492 which has an IP alias of 192.5.5.213, and has one interface,
493 ep0 (a 3Com 3C589C).
494 Booting intervals have been shortened somewhat from the default, because
495 the client is known to spend most of its time on networks with little DHCP
496 activity.
497 The laptop does roam to multiple networks.
498 .Bd -literal -offset indent
499 timeout 60;
500 retry 60;
501 reboot 10;
502 select-timeout 5;
503 initial-interval 2;
504 reject 192.33.137.209;
505
506 interface "ep0" {
507     send host-name "andare.fugue.com";
508     send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
509     send dhcp-lease-time 3600;
510     supersede domain-name "fugue.com rc.vix.com home.vix.com";
511     prepend domain-name-servers 127.0.0.1;
512     request subnet-mask, broadcast-address, time-offset, routers,
513             domain-name, domain-name-servers, host-name;
514     require subnet-mask, domain-name-servers;
515     script "/etc/dhclient-script";
516     media "media 10baseT/UTP", "media 10base2/BNC";
517 }
518
519 alias {
520   interface "ep0";
521   fixed-address 192.5.5.213;
522   option subnet-mask 255.255.255.255;
523 }
524 .Ed
525 .Pp
526 This is a very complicated
527 .Nm
528 file \- in general, yours should be much simpler.
529 In many cases, it's sufficient to just create an empty
530 .Nm
531 file \- the defaults are usually fine.
532 .Sh SEE ALSO
533 .Xr dhclient.leases 5 ,
534 .Xr dhcp-options 5 ,
535 .Xr dhcpd.conf 5 Pq Pa pkgsrc/net/isc-dhcpd4 ,
536 .Xr dhclient 8 ,
537 .Xr dhcpd 8 Pq Pa pkgsrc/net/isc-dhcpd4
538 .Pp
539 RFC 2132, RFC 2131.
540 .Sh AUTHORS
541 .An -nosplit
542 .Xr dhclient 8
543 was written by
544 .An Ted Lemon Aq mellon@vix.com
545 under a contract with Vixie Labs.
546 .Pp
547 The current implementation was reworked by
548 .An Henning Brauer Aq henning@openbsd.org .