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