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