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