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.D1 Ic lease No { Ar lease-declaration Oo Ar ... lease-declaration Oc } 275.Pp 276The DHCP client may decide after some period of time (see 277.Sx PROTOCOL TIMING ) 278that it is not going to succeed in contacting a server. 279At that time, it consults its own database of old leases and tests each one 280that has not yet timed out by pinging the listed router for that lease to 281see if that lease could work. 282It is possible to define one or more 283.Em fixed 284leases in the client configuration file for networks where there is no DHCP 285or BOOTP service, so that the client can still automatically configure its 286address. 287This is done with the 288.Ic lease 289statement. 290.Pp 291NOTE: the lease statement is also used in the 292.Pa dhclient.leases 293file in order to record leases that have been received from DHCP servers. 294Some of the syntax for leases as described below is only needed in the 295.Pa dhclient.leases 296file. 297Such syntax is documented here for completeness. 298.Pp 299A lease statement consists of the lease keyword, followed by a left 300curly brace, followed by one or more lease declaration statements, 301followed by a right curly brace. 302The following lease declarations are possible: 303.Bl -tag -width Ds 304.It Ic bootp ; 305The 306.Ic bootp 307statement is used to indicate that the lease was acquired using the 308BOOTP protocol rather than the DHCP protocol. 309It is never necessary to specify this in the client configuration file. 310The client uses this syntax in its lease database file. 311.It Ic interface Ar \&"string\&" ; 312The 313.Ic interface 314lease statement is used to indicate the interface on which the lease is valid. 315If set, this lease will only be tried on a particular interface. 316When the client receives a lease from a server, it always records the 317interface number on which it received that lease. 318If predefined leases are specified in the 319.Nm 320file, the interface should also be specified, although this is not required. 321.It Ic fixed-address Ar ip-address ; 322The 323.Ic fixed-address 324statement is used to set the IP address of a particular lease. 325This is required for all lease statements. 326The IP address must be specified as a dotted quad (e.g., 12.34.56.78). 327.It Ic filename Ar \&"string\&" ; 328The 329.Ic filename 330statement specifies the name of the boot filename to use. 331This is not used by the standard client configuration script, but is 332included for completeness. 333.It Ic server-name Ar \&"string\&" ; 334The 335.Ic server-name 336statement specifies the name of the boot server name to use. 337This is also not used by the standard client configuration script. 338.It Ic option Ar option-declaration ; 339The 340.Ic option 341statement is used to specify the value of an option supplied by the server, 342or, in the case of predefined leases declared in 343.Nm , 344the value that the user wishes the client configuration script to use if the 345predefined lease is used. 346.It Ic medium Ar \&"media setup\&" ; 347The 348.Ic medium 349statement can be used on systems where network interfaces cannot 350automatically determine the type of network to which they are connected. 351The media setup string is a system-dependent parameter which is passed 352to the DHCP client configuration script when initializing the interface. 353On 354.Ux 355and UNIX-like systems, the argument is passed on the ifconfig command line 356when configuring the interface. 357.Pp 358The DHCP client automatically declares this parameter if it used a 359media type (see the 360.Ic media 361statement) when configuring the interface in order to obtain a lease. 362This statement should be used in predefined leases only if the network 363interface requires media type configuration. 364.It Ic renew Ar date ; 365.It Ic rebind Ar date ; 366.It Ic expire Ar date ; 367The 368.Ic renew 369statement defines the time at which the DHCP client should begin trying to 370contact its server to renew a lease that it is using. 371The 372.Ic rebind 373statement defines the time at which the DHCP client should begin to try to 374contact 375.Em any 376DHCP server in order to renew its lease. 377The 378.Ic expire 379statement defines the time at which the DHCP client must stop using a lease 380if it has not been able to contact a server in order to renew it. 381.El 382.Pp 383These declarations are automatically set in leases acquired by the 384DHCP client, but must also be configured in predefined leases \- a 385predefined lease whose expiry time has passed will not be used by the 386DHCP client. 387.Pp 388Dates are specified as follows: 389.Bd -ragged -offset indent 390.Ar <weekday> 391.Sm off 392.Ar <year> No / Ar <month> No / Ar <day> 393.Ar <hour> : <minute> : <second> 394.Sm on 395.Ed 396.Pp 397The weekday is present to make it easy for a human to tell when a 398lease expires \- it's specified as a number from zero to six, with zero 399being Sunday. 400When declaring a predefined lease, it can always be specified as zero. 401The year is specified with the century, so it should generally be four 402digits except for really long leases. 403The month is specified as a number starting with 1 for January. 404The day of the month is likewise specified starting with 1. 405The hour is a number between 0 and 23, 406the minute a number between 0 and 59, 407and the second also a number between 0 and 59. 408.Sh ALIAS DECLARATIONS 409.Ic alias No { Ar declarations ... No } 410.Pp 411Some DHCP clients running TCP/IP roaming protocols may require that in 412addition to the lease they may acquire via DHCP, their interface also 413be configured with a predefined IP alias so that they can have a 414permanent IP address even while roaming. 415The Internet Software Consortium DHCP client doesn't support roaming with 416fixed addresses directly, but in order to facilitate such experimentation, 417the DHCP client can be set up to configure an IP alias using the 418.Ic alias 419declaration. 420.Pp 421The 422.Ic alias 423declaration resembles a lease declaration, except that options other than 424the subnet-mask option are ignored by the standard client configuration 425script, and expiry times are ignored. 426A typical alias declaration includes an interface declaration, a fixed-address 427declaration for the IP alias address, and a subnet-mask option declaration. 428A medium statement should never be included in an alias declaration. 429.Sh OTHER DECLARATIONS 430.Bl -tag -width Ds 431.It Ic reject Ar ip-address ; 432The 433.Ic reject 434statement causes the DHCP client to reject offers from servers who use 435the specified address as a server identifier. 436This can be used to avoid being configured by rogue or misconfigured DHCP 437servers, although it should be a last resort \- better to track down 438the bad DHCP server and fix it. 439.It Xo 440.Ic interface Ar \&"name\&" No { Ar declarations 441.Ar ... No } 442.Xc 443A client with more than one network interface may require different 444behaviour depending on which interface is being configured. 445All timing parameters and declarations other than lease and alias 446declarations can be enclosed in an interface declaration, and those 447parameters will then be used only for the interface that matches the 448specified name. 449Interfaces for which there is no interface declaration will use the 450parameters declared outside of any interface declaration, 451or the default settings. 452.It Xo 453.Ic media Ar \&"media setup\&" 454.Oo , Ar \&"media setup\&" , ... Oc ; 455.Xc 456The 457.Ic media 458statement defines one or more media configuration parameters which may 459be tried while attempting to acquire an IP address. 460The DHCP client will cycle through each media setup string on the list, 461configuring the interface using that setup and attempting to boot, 462and then trying the next one. 463This can be used for network interfaces which aren't capable of sensing 464the media type unaided \- whichever media type succeeds in getting a request 465to the server and hearing the reply is probably right (no guarantees). 466.Pp 467The media setup is only used for the initial phase of address 468acquisition (the DHCPDISCOVER and DHCPOFFER packets). 469Once an address has been acquired, the DHCP client will record it in its 470lease database and will record the media type used to acquire the address. 471Whenever the client tries to renew the lease, it will use that same media type. 472The lease must expire before the client will go back to cycling through media 473types. 474.It Ic script Ar \&"script-name\&" ; 475The 476.Ic script 477statement is used to specify the pathname of the DHCP client configuration 478script. 479This script is used by the DHCP client to set each interface's initial 480configuration prior to requesting an address, to test the address once it 481has been offered, and to set the interface's final configuration once a 482lease has been acquired. 483If no lease is acquired, the script is used to test predefined leases, if 484any, and also called once if no valid lease can be identified. 485For more information, see 486.Xr dhclient.leases 5 . 487.El 488.Sh EXAMPLES 489The following configuration file is used on a laptop 490which has an IP alias of 192.5.5.213, and has one interface, 491ep0 (a 3Com 3C589C). 492Booting intervals have been shortened somewhat from the default, because 493the client is known to spend most of its time on networks with little DHCP 494activity. 495The laptop does roam to multiple networks. 496.Bd -literal -offset indent 497timeout 60; 498retry 60; 499reboot 10; 500select-timeout 5; 501initial-interval 2; 502reject 192.33.137.209; 503 504interface "ep0" { 505 send host-name "andare.fugue.com"; 506 send dhcp-client-identifier 1:0:a0:24:ab:fb:9c; 507 send dhcp-lease-time 3600; 508 supersede domain-name "fugue.com rc.vix.com home.vix.com"; 509 prepend domain-name-servers 127.0.0.1; 510 request subnet-mask, broadcast-address, time-offset, routers, 511 domain-name, domain-name-servers, host-name; 512 require subnet-mask, domain-name-servers; 513 script "/etc/dhclient-script"; 514 media "media 10baseT/UTP", "media 10base2/BNC"; 515} 516 517alias { 518 interface "ep0"; 519 fixed-address 192.5.5.213; 520 option subnet-mask 255.255.255.255; 521} 522.Ed 523.Pp 524This is a very complicated 525.Nm 526file \- in general, yours should be much simpler. 527In many cases, it's sufficient to just create an empty 528.Nm 529file \- the defaults are usually fine. 530.Sh SEE ALSO 531.Xr dhclient.leases 5 , 532.Xr dhcp-options 5 , 533.Xr dhcpd.conf 5 Pq Pa pkgsrc/net/isc-dhcpd4 , 534.Xr dhclient 8 , 535.Xr dhcpd 8 Pq Pa pkgsrc/net/isc-dhcpd4 536.Pp 537RFC 2132, RFC 2131. 538.Sh AUTHORS 539.An -nosplit 540.Xr dhclient 8 541was written by 542.An Ted Lemon Aq mellon@vix.com 543under a contract with Vixie Labs. 544.Pp 545The current implementation was reworked by 546.An Henning Brauer Aq henning@openbsd.org . 547