1.\" $OpenBSD: src/sbin/dhclient/dhclient.conf.5,v 1.21 2011/04/09 19:53:00 krw 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 July 23, 2013 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 . 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. 145It defaults to fifteen seconds. 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. 155It defaults to three seconds. 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. 161The default value is ten seconds. 162The value zero requests that 163dhclient not 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 Ic request Op Ar option , ... ; 181The 182.Ic request 183statement causes the client to request that any server responding to the 184client send the client its values for the specified options. 185Only option names should be specified in the request statement \- not 186option values. 187Only the last 188.Ic request 189statement has any effect, overriding any previous 190.Ic request 191statement. 192.It Ic require Op Ar option , ... ; 193The 194.Ic require 195statement lists options that must be sent in order for an offer to be accepted. 196Offers that do not contain all the listed options will be ignored. 197Only option names should be specified in the require statement \- not 198option values. 199Only the last 200.Ic require 201statement has any effect, overriding any previous 202.Ic require 203statement. 204.It Ic send Ar option option-value ; 205The 206.Ic send 207statement causes the client to send the specified option and value 208to the server. 209Options that are always sent in the DHCP protocol should not be specified 210here. 211One use for this statement is to send information to the server 212that will allow it to differentiate between this client and other 213clients or kinds of clients. 214.El 215.Sh OPTION MODIFIERS 216Options in the lease can be modified before being passed to the client 217configuration script, 218.Xr dhclient-script 8 . 219.Pp 220The default client configuration script 221processes only options 1 (subnet 222mask), 3 (routers), 6 (domain name servers), 15 (domain-name). 223Use of option modifiers on other options will have no effect unless 224.Xr dhclient-script 8 225the client configuration script is modified. 226.Pp 227Several option modifiers are available. 228.Bl -tag -width Ds 229.It Ic default Ar option option-value ; 230Use 231.Ar option-value 232for the given 233.Ar option , 234if no value is supplied by the server. 235.It Ic supersede Ar option option-value ; 236Use 237.Ar option-value 238for the given 239.Ar option , 240regardless of the value supplied by the server. 241.It Ic prepend Ar option option-value ; 242Use 243.Ar option-value 244for the given 245.Ar option , 246and then use the value supplied by the server. 247.Ic prepend 248can only be used for options which allow more than one value to be given. 249The restriction is not enforced \- if violated, the results are unpredictable. 250.It Ic append Ar option option-value ; 251Use 252.Ar option-value 253for the given 254.Ar option , 255after first using the value supplied by the server. 256.Ic append 257can only be used for options which allow more than one value to be given. 258The restriction is not enforced \- if violated, the results are unpredictable. 259.El 260.Sh LEASE DECLARATIONS 261The lease declaration: 262.Pp 263.D1 Ic lease No { Ar lease-declaration ; ... ; No } 264.Pp 265The DHCP client may decide after some period of time (see 266.Sx PROTOCOL TIMING ) 267that it is not going to succeed in contacting a server. 268At that time, it consults its own database of old leases and tests each one 269that has not yet timed out by pinging the listed router for that lease to 270see if that lease could work. 271It is possible to define one or more 272.Em fixed 273leases in the client configuration file for networks where there is no DHCP 274or BOOTP service, so that the client can still automatically configure its 275address. 276This is done with the 277.Ic lease 278statement. 279.Pp 280NOTE: the lease statement is also used in the 281.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME 282file in order to record leases that have been received from DHCP servers. 283Some of the syntax for leases as described below is only needed in the 284.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME 285file. 286Such syntax is documented here for completeness. 287.Pp 288A lease statement consists of the lease keyword, followed by a left 289curly brace, followed by one or more lease declaration statements, 290followed by a right curly brace. 291The following lease declarations are possible: 292.Pp 293.Bl -tag -width Ds -compact 294.It Ic bootp ; 295The 296.Ic bootp 297statement is used to indicate that the lease was acquired using the 298BOOTP protocol rather than the DHCP protocol. 299It is never necessary to specify this in the client configuration file. 300The client uses this syntax in its lease database file. 301.Pp 302.It Ic interface Qq Ar string ; 303The 304.Ic interface 305lease statement is used to indicate the interface on which the lease is valid. 306If set, this lease will only be tried on a particular interface. 307When the client receives a lease from a server, it always records the 308interface number on which it received that lease. 309If predefined leases are specified in the 310.Nm 311file, the interface should also be specified, although this is not required. 312.Pp 313.It Ic fixed-address Ar ip-address ; 314The 315.Ic fixed-address 316statement is used to set the IP address of a particular lease. 317This is required for all lease statements. 318The IP address must be specified as a dotted quad (e.g., 12.34.56.78). 319.Pp 320.It Ic filename Qq Ar string ; 321The 322.Ic filename 323statement specifies the name of the boot filename to use. 324This is not used by the standard client, but is included for completeness. 325.Pp 326.It Ic server-name Qq Ar string ; 327The 328.Ic server-name 329statement specifies the name of the boot server name to use. 330This is not used by the standard client, but is included for completeness. 331.Pp 332.It Ic option Ar option option-value ; 333The 334.Ic option 335statement is used to specify the value of an option supplied by the server, 336or, in the case of predefined leases declared in 337.Nm , 338the value that the user wishes the client to use if the 339predefined lease is used. 340.Pp 341.It Ic renew Ar date ; 342.It Ic rebind Ar date ; 343.It Ic expire Ar date ; 344The 345.Ic renew 346statement defines the time at which the DHCP client should begin trying to 347contact its server to renew a lease that it is using. 348The 349.Ic rebind 350statement defines the time at which the DHCP client should begin to try to 351contact 352.Em any 353DHCP server in order to renew its lease. 354The 355.Ic expire 356statement defines the time at which the DHCP client must stop using a lease 357if it has not been able to contact a server in order to renew it. 358.El 359.Pp 360These declarations are automatically set in leases acquired by the 361DHCP client, but must also be configured in predefined leases \- a 362predefined lease whose expiry time has passed will not be used by the 363DHCP client. 364.Pp 365Dates are specified as follows: 366.Pp 367.D1 <weekday> <year>/<month>/<day> <hour>:<minute>:<second> 368.Pp 369The weekday is present to make it easy for a human to tell when a 370lease expires \- it's specified as a number from zero to six, with zero 371being Sunday. 372When declaring a predefined lease, it can always be specified as zero. 373The year is specified with the century, so it should generally be four 374digits except for really long leases. 375The month is specified as a number starting with 1 for January. 376The day of the month is likewise specified starting with 1. 377The hour is a number between 0 and 23, 378the minute a number between 0 and 59, 379and the second also a number between 0 and 59. 380.Sh OTHER DECLARATIONS 381.Bl -tag -width Ds 382.It Ic reject Ar ip-address ; 383The 384.Ic reject 385statement causes the DHCP client to reject offers from servers who use 386the specified address as a server identifier. 387This can be used to avoid being configured by rogue or misconfigured DHCP 388servers, although it should be a last resort \- better to track down 389the bad DHCP server and fix it. 390.It Ic interface Qo Ar name Qc No { Ar declaration ; ... ; No } 391A client with more than one network interface may require different 392behaviour depending on which interface is being configured. 393All timing parameters and declarations other than lease 394declarations can be enclosed in an interface declaration, and those 395parameters will then be used only for the interface that matches the 396specified name. 397Interfaces for which there is no interface declaration will use the 398parameters declared outside of any interface declaration, 399or the default settings. 400.It Ic script Ar \&"script-name\&" ; 401The 402.Ic script 403statement is used to specify the pathname of the client configuration 404script. 405This script is used by the DHCP client to set each interface's initial 406configuration prior to requesting an address, to test the address once it 407has been offered, and to set the interface's final configuration once a 408lease has been acquired. 409If no lease is acquired, the script is used to test predefined leases, if 410any, and also called once if no valid lease can be identified. 411For more information, see 412.Xr dhclient.leases 5 . 413.El 414.Sh EXAMPLES 415The following configuration file is used on a laptop 416which has one interface, ep0 (a 3Com 3C589C). 417Booting intervals have been shortened somewhat from the default, because 418the client is known to spend most of its time on networks with little DHCP 419activity. 420The laptop does roam to multiple networks. 421.Bd -literal -offset indent 422timeout 60; 423retry 60; 424reboot 10; 425select-timeout 5; 426initial-interval 2; 427reject 192.33.137.209; 428 429interface "ep0" { 430 send host-name "andare.fugue.com"; 431 send dhcp-client-identifier 1:0:a0:24:ab:fb:9c; 432 send dhcp-lease-time 3600; 433 supersede domain-name "fugue.com rc.vix.com home.vix.com"; 434 prepend domain-name-servers 127.0.0.1; 435 request subnet-mask, broadcast-address, time-offset, routers, 436 domain-name, domain-name-servers, host-name; 437 require subnet-mask, domain-name-servers; 438 script "/etc/dhclient-script"; 439} 440.Ed 441.Pp 442This is a very complicated 443.Nm 444file \- in general, yours should be much simpler. 445In many cases, it's sufficient to just create an empty 446.Nm 447file \- the defaults are usually fine. 448.Sh SEE ALSO 449.Xr dhclient.leases 5 , 450.Xr dhcp-options 5 , 451.Xr dhcpd.conf 5 Pq Pa net/isc-dhcp42-server , 452.Xr dhclient 8 , 453.Xr dhclient-script 8 , 454.Xr dhcpd 8 Pq Pa net/isc-dhcp42-server 455.Sh STANDARDS 456.Rs 457.%A R. Droms 458.%D March 1997 459.%R RFC 2131 460.%T Dynamic Host Configuration Protocol 461.Re 462.Pp 463.Rs 464.%A S. Alexander 465.%A R. Droms 466.%D March 1997 467.%R RFC 2132 468.%T DHCP Options and BOOTP Vendor Extensions 469.Re 470.Sh AUTHORS 471.An -nosplit 472.Xr dhclient 8 473was written by 474.An Ted Lemon Aq Mt mellon@vix.com 475under a contract with Vixie Labs. 476.Pp 477The current implementation was reworked by 478.An Henning Brauer Aq Mt henning@openbsd.org . 479