Revert "kprintf.9: Remove unneeded header."
[dragonfly.git] / sbin / dhclient / dhclient.conf.5
CommitLineData
dafcba85 1.\" $OpenBSD: src/sbin/dhclient/dhclient.conf.5,v 1.24 2012/10/27 23:08:53 krw Exp $
846204b6
HT
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.\"
dafcba85 39.Dd August 9, 2014
846204b6
HT
40.Dt DHCLIENT.CONF 5
41.Os
42.Sh NAME
43.Nm dhclient.conf
44.Nd DHCP client configuration file
45.Sh DESCRIPTION
46The
47.Nm
48file contains configuration information for
0f17c1ab 49.Xr dhclient 8 .
846204b6
HT
50.Pp
51The
52.Nm
53file is a free-form ASCII text file.
54It is parsed by the recursive-descent parser built into
55.Xr dhclient 8 .
56The file may contain extra tabs and newlines for formatting purposes.
57Keywords in the file are case-insensitive.
58Comments may be placed anywhere within the file (except within quotes).
59Comments begin with the
60.Sq #
61character and end at the end of the line.
62.Pp
63The
64.Nm
65file can be used to configure the behaviour of the client in a wide variety
66of ways: protocol timing, information requested from the server, information
67required of the server, defaults to use if the server does not provide
68certain information, values with which to override information provided by
69the server, or values to prepend or append to information provided by the
70server.
71The configuration file can also be preinitialized with addresses to
72use on networks that don't have DHCP servers.
73.Sh PROTOCOL TIMING
74The timing behaviour of the client need not be configured by the user.
75If no timing configuration is provided by the user, a fairly
76reasonable timing behaviour will be used by default \- one which
77results in fairly timely updates without placing an inordinate load on
78the server.
79.Pp
80The following statements can be used to adjust the timing behaviour of
81the DHCP client if required, however:
82.Bl -tag -width Ds
83.It Ic timeout Ar time ;
84The
85.Ic timeout
86statement determines the amount of time that must pass between the
87time that the client begins to try to determine its address and the
88time that it decides that it's not going to be able to contact a server.
89By default, this timeout is sixty seconds.
90After the timeout has passed, if there are any static leases defined in the
91configuration file, or any leases remaining in the lease database that
92have not yet expired, the client will loop through these leases
93attempting to validate them, and if it finds one that appears to be
94valid, it will use that lease's address.
95If there are no valid static leases or unexpired leases in the lease database,
96the client will restart the protocol after the defined retry interval.
97.It Ic retry Ar time ;
98The
99.Ic retry
100statement determines the time that must pass after the client has
101determined that there is no DHCP server present before it tries again
102to contact a DHCP server.
103By default, this is five minutes.
104.It Ic select-timeout Ar time ;
105It is possible (some might say desirable) for there to be more than
106one DHCP server serving any given network.
107In this case, it is possible that a client may be sent more than one offer
108in response to its initial lease discovery message.
109It may be that one of these offers is preferable to the other
110(e.g., one offer may have the address the client previously used,
111and the other may not).
112.Pp
113The
114.Ic select-timeout
115is the time after the client sends its first lease discovery request
116at which it stops waiting for offers from servers, assuming that it
117has received at least one such offer.
118If no offers have been received by the time the
119.Ic select-timeout
120has expired, the client will accept the first offer that arrives.
121.Pp
122By default, the
123.Ic select-timeout
124is zero seconds \- that is, the client will take the first offer it sees.
125.It Ic reboot Ar time ;
126When the client is restarted, it first tries to reacquire the last
127address it had.
128This is called the INIT-REBOOT state.
129If it is still attached to the same network it was attached to when it last
130ran, this is the quickest way to get started.
131The
132.Ic reboot
133statement sets the time that must elapse after the client first tries
134to reacquire its old address before it gives up and tries to discover
135a new address.
136By default, the reboot timeout is ten seconds.
137.It Ic backoff-cutoff Ar time ;
138The client uses an exponential backoff algorithm with some randomness,
139so that if many clients try to configure themselves at the same time,
140they will not make their requests in lockstep.
141The
142.Ic backoff-cutoff
143statement determines the maximum amount of time that the client is
144allowed to back off.
58c1d362 145It defaults to fifteen seconds.
846204b6
HT
146.It Ic initial-interval Ar time ;
147The
148.Ic initial-interval
149statement sets the amount of time between the first attempt to reach a
150server and the second attempt to reach a server.
151Each time a message is sent, the interval between messages is incremented by
152twice the current interval multiplied by a random number between zero and one.
153If it is greater than the backoff-cutoff amount, it is set to that
154amount.
58c1d362 155It defaults to three seconds.
846204b6
HT
156.It Ic link-timeout Ar time ;
157The
158.Ic link-timeout
159statement sets the amount of time to wait for an interface link before timing
160out.
a967e40c
AHJ
161The default value is ten seconds.
162The value zero requests that
58c1d362 163dhclient not wait for a link state change before timing out.
846204b6
HT
164.El
165.Sh LEASE REQUIREMENTS AND REQUESTS
166The DHCP protocol allows the client to request that the server send it
167specific information, and not send it other information that it is not
168prepared to accept.
169The protocol also allows the client to reject offers from servers if they
170don't contain information the client needs, or if the information provided
171is not satisfactory.
172.Pp
173There is a variety of data contained in offers that DHCP servers send
174to DHCP clients.
175The data that can be specifically requested is what are called
176.Em DHCP Options .
177DHCP Options are defined in
178.Xr dhcp-options 5 .
179.Bl -tag -width Ds
dafcba85
AHJ
180.It Ic ignore Op Ar option
181The
182.Ic ignore
183statement causes the client to discard values provided by the server for
184the specified options.
185Only the option names should be specified in the ignore statement \- not
186option parameters.
0f17c1ab 187.It Ic request Op Ar option , ... ;
846204b6
HT
188The
189.Ic request
190statement causes the client to request that any server responding to the
191client send the client its values for the specified options.
0f17c1ab
FF
192Only option names should be specified in the request statement \- not
193option values.
194Only the last
195.Ic request
196statement has any effect, overriding any previous
197.Ic request
198statement.
199.It Ic require Op Ar option , ... ;
846204b6
HT
200The
201.Ic require
202statement lists options that must be sent in order for an offer to be accepted.
203Offers that do not contain all the listed options will be ignored.
0f17c1ab
FF
204Only option names should be specified in the require statement \- not
205option values.
206Only the last
207.Ic require
208statement has any effect, overriding any previous
209.Ic require
210statement.
211.It Ic send Ar option option-value ;
846204b6
HT
212The
213.Ic send
0f17c1ab
FF
214statement causes the client to send the specified option and value
215to the server.
846204b6
HT
216Options that are always sent in the DHCP protocol should not be specified
217here.
218One use for this statement is to send information to the server
219that will allow it to differentiate between this client and other
220clients or kinds of clients.
221.El
222.Sh OPTION MODIFIERS
4c9ce022
AHJ
223Options in the lease can be modified before being passed to the client
224configuration script,
bbea0c93 225.Xr dhclient-script 8 .
4c9ce022 226.Pp
bbea0c93 227The default client configuration script
4c9ce022 228processes only options 1 (subnet
ee1dc8e7 229mask), 3 (routers), 6 (domain name servers), 15 (domain-name).
4c9ce022 230Use of option modifiers on other options will have no effect unless
bbea0c93
AHJ
231.Xr dhclient-script 8
232the client configuration script is modified.
4c9ce022
AHJ
233.Pp
234Several option modifiers are available.
846204b6 235.Bl -tag -width Ds
0f17c1ab
FF
236.It Ic default Ar option option-value ;
237Use
238.Ar option-value
239for the given
240.Ar option ,
241if no value is supplied by the server.
242.It Ic supersede Ar option option-value ;
243Use
244.Ar option-value
245for the given
246.Ar option ,
247regardless of the value supplied by the server.
248.It Ic prepend Ar option option-value ;
249Use
250.Ar option-value
251for the given
252.Ar option ,
253and then use the value supplied by the server.
846204b6 254.Ic prepend
0f17c1ab
FF
255can only be used for options which allow more than one value to be given.
256The restriction is not enforced \- if violated, the results are unpredictable.
257.It Ic append Ar option option-value ;
258Use
259.Ar option-value
260for the given
261.Ar option ,
262after first using the value supplied by the server.
846204b6 263.Ic append
0f17c1ab
FF
264can only be used for options which allow more than one value to be given.
265The restriction is not enforced \- if violated, the results are unpredictable.
846204b6
HT
266.El
267.Sh LEASE DECLARATIONS
268The lease declaration:
269.Pp
0f17c1ab 270.D1 Ic lease No { Ar lease-declaration ; ... ; No }
846204b6
HT
271.Pp
272The DHCP client may decide after some period of time (see
273.Sx PROTOCOL TIMING )
274that it is not going to succeed in contacting a server.
275At that time, it consults its own database of old leases and tests each one
276that has not yet timed out by pinging the listed router for that lease to
277see if that lease could work.
278It is possible to define one or more
279.Em fixed
280leases in the client configuration file for networks where there is no DHCP
281or BOOTP service, so that the client can still automatically configure its
282address.
283This is done with the
284.Ic lease
285statement.
286.Pp
287NOTE: the lease statement is also used in the
0f17c1ab 288.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
846204b6
HT
289file in order to record leases that have been received from DHCP servers.
290Some of the syntax for leases as described below is only needed in the
0f17c1ab 291.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
846204b6
HT
292file.
293Such syntax is documented here for completeness.
294.Pp
295A lease statement consists of the lease keyword, followed by a left
296curly brace, followed by one or more lease declaration statements,
297followed by a right curly brace.
298The following lease declarations are possible:
0f17c1ab
FF
299.Pp
300.Bl -tag -width Ds -compact
846204b6
HT
301.It Ic bootp ;
302The
303.Ic bootp
304statement is used to indicate that the lease was acquired using the
305BOOTP protocol rather than the DHCP protocol.
306It is never necessary to specify this in the client configuration file.
307The client uses this syntax in its lease database file.
0f17c1ab
FF
308.Pp
309.It Ic interface Qq Ar string ;
846204b6
HT
310The
311.Ic interface
312lease statement is used to indicate the interface on which the lease is valid.
313If set, this lease will only be tried on a particular interface.
314When the client receives a lease from a server, it always records the
315interface number on which it received that lease.
316If predefined leases are specified in the
317.Nm
318file, the interface should also be specified, although this is not required.
0f17c1ab 319.Pp
846204b6
HT
320.It Ic fixed-address Ar ip-address ;
321The
322.Ic fixed-address
323statement is used to set the IP address of a particular lease.
324This is required for all lease statements.
325The IP address must be specified as a dotted quad (e.g., 12.34.56.78).
0f17c1ab
FF
326.Pp
327.It Ic filename Qq Ar string ;
846204b6
HT
328The
329.Ic filename
330statement specifies the name of the boot filename to use.
0f17c1ab
FF
331This is not used by the standard client, but is included for completeness.
332.Pp
333.It Ic server-name Qq Ar string ;
846204b6
HT
334The
335.Ic server-name
336statement specifies the name of the boot server name to use.
0f17c1ab
FF
337This is not used by the standard client, but is included for completeness.
338.Pp
339.It Ic option Ar option option-value ;
846204b6
HT
340The
341.Ic option
342statement is used to specify the value of an option supplied by the server,
343or, in the case of predefined leases declared in
833973ed 344.Nm ,
0f17c1ab 345the value that the user wishes the client to use if the
846204b6 346predefined lease is used.
0f17c1ab 347.Pp
846204b6
HT
348.It Ic renew Ar date ;
349.It Ic rebind Ar date ;
350.It Ic expire Ar date ;
351The
352.Ic renew
353statement defines the time at which the DHCP client should begin trying to
354contact its server to renew a lease that it is using.
355The
356.Ic rebind
357statement defines the time at which the DHCP client should begin to try to
358contact
359.Em any
360DHCP server in order to renew its lease.
361The
362.Ic expire
363statement defines the time at which the DHCP client must stop using a lease
364if it has not been able to contact a server in order to renew it.
365.El
366.Pp
367These declarations are automatically set in leases acquired by the
368DHCP client, but must also be configured in predefined leases \- a
369predefined lease whose expiry time has passed will not be used by the
370DHCP client.
371.Pp
372Dates are specified as follows:
0f17c1ab
FF
373.Pp
374.D1 <weekday> <year>/<month>/<day> <hour>:<minute>:<second>
846204b6
HT
375.Pp
376The weekday is present to make it easy for a human to tell when a
377lease expires \- it's specified as a number from zero to six, with zero
378being Sunday.
379When declaring a predefined lease, it can always be specified as zero.
380The year is specified with the century, so it should generally be four
381digits except for really long leases.
382The month is specified as a number starting with 1 for January.
383The day of the month is likewise specified starting with 1.
384The hour is a number between 0 and 23,
385the minute a number between 0 and 59,
386and the second also a number between 0 and 59.
846204b6
HT
387.Sh OTHER DECLARATIONS
388.Bl -tag -width Ds
389.It Ic reject Ar ip-address ;
390The
391.Ic reject
392statement causes the DHCP client to reject offers from servers who use
393the specified address as a server identifier.
394This can be used to avoid being configured by rogue or misconfigured DHCP
395servers, although it should be a last resort \- better to track down
396the bad DHCP server and fix it.
0f17c1ab 397.It Ic interface Qo Ar name Qc No { Ar declaration ; ... ; No }
846204b6
HT
398A client with more than one network interface may require different
399behaviour depending on which interface is being configured.
7cbe3601 400All timing parameters and declarations other than lease
846204b6
HT
401declarations can be enclosed in an interface declaration, and those
402parameters will then be used only for the interface that matches the
403specified name.
404Interfaces for which there is no interface declaration will use the
405parameters declared outside of any interface declaration,
406or the default settings.
846204b6
HT
407.It Ic script Ar \&"script-name\&" ;
408The
409.Ic script
bbea0c93 410statement is used to specify the pathname of the client configuration
846204b6
HT
411script.
412This script is used by the DHCP client to set each interface's initial
413configuration prior to requesting an address, to test the address once it
414has been offered, and to set the interface's final configuration once a
415lease has been acquired.
416If no lease is acquired, the script is used to test predefined leases, if
417any, and also called once if no valid lease can be identified.
418For more information, see
419.Xr dhclient.leases 5 .
420.El
421.Sh EXAMPLES
422The following configuration file is used on a laptop
7cbe3601 423which has one interface, ep0 (a 3Com 3C589C).
846204b6
HT
424Booting intervals have been shortened somewhat from the default, because
425the client is known to spend most of its time on networks with little DHCP
426activity.
427The laptop does roam to multiple networks.
428.Bd -literal -offset indent
429timeout 60;
430retry 60;
431reboot 10;
432select-timeout 5;
433initial-interval 2;
434reject 192.33.137.209;
435
436interface "ep0" {
437 send host-name "andare.fugue.com";
438 send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
439 send dhcp-lease-time 3600;
440 supersede domain-name "fugue.com rc.vix.com home.vix.com";
441 prepend domain-name-servers 127.0.0.1;
442 request subnet-mask, broadcast-address, time-offset, routers,
6bdc8b43
MD
443 classless-routes, domain-name, domain-name-servers,
444 host-name;
846204b6
HT
445 require subnet-mask, domain-name-servers;
446 script "/etc/dhclient-script";
846204b6
HT
447}
448.Ed
449.Pp
450This is a very complicated
451.Nm
452file \- in general, yours should be much simpler.
453In many cases, it's sufficient to just create an empty
454.Nm
455file \- the defaults are usually fine.
456.Sh SEE ALSO
457.Xr dhclient.leases 5 ,
458.Xr dhcp-options 5 ,
c8e8a2e5 459.Xr dhcpd.conf 5 Pq Pa net/isc-dhcp42-server ,
846204b6 460.Xr dhclient 8 ,
0f17c1ab 461.Xr dhclient-script 8 ,
c8e8a2e5 462.Xr dhcpd 8 Pq Pa net/isc-dhcp42-server
0f17c1ab
FF
463.Sh STANDARDS
464.Rs
465.%A R. Droms
466.%D March 1997
467.%R RFC 2131
468.%T Dynamic Host Configuration Protocol
469.Re
846204b6 470.Pp
0f17c1ab
FF
471.Rs
472.%A S. Alexander
473.%A R. Droms
474.%D March 1997
475.%R RFC 2132
476.%T DHCP Options and BOOTP Vendor Extensions
477.Re
846204b6
HT
478.Sh AUTHORS
479.An -nosplit
480.Xr dhclient 8
481was written by
1cb631f7 482.An Ted Lemon Aq Mt mellon@vix.com
846204b6
HT
483under a contract with Vixie Labs.
484.Pp
485The current implementation was reworked by
1cb631f7 486.An Henning Brauer Aq Mt henning@openbsd.org .