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