1.\" $OpenBSD: dhcpd.leases.5,v 1.14 2024/06/27 16:39:31 florian Exp $ 2.\" 3.\" Copyright (c) 1997, 1998 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 $Mdocdate: June 27 2024 $ 40.Dt DHCPD.LEASES 5 41.Os 42.Sh NAME 43.Nm dhcpd.leases 44.Nd DHCP server lease database 45.Sh DESCRIPTION 46The Internet Software Consortium DHCP Server keeps a persistent 47database of leases that it has assigned. 48This database is a free-form ASCII file containing a series of 49lease declarations. 50Every time a lease is acquired, renewed or released, its new value is 51recorded at the end of the lease file. 52So if more than one declaration appears for a given lease, 53the last one in the file is the current one. 54.Sh FORMAT 55Currently, the only declaration that is used in the 56.Nm 57file is the 58.Ic lease 59declaration. 60.Pp 61.D1 Ic lease Ar ip-address No { Ar statements... No } 62.Pp 63Each lease declaration includes the single IP address that has been 64leased to the client. 65The statements within the braces define the duration of the lease 66and to whom it is assigned. 67.Pp 68The start and end time of a lease are recorded using the 69.Ic starts 70and 71.Ic ends 72statements: 73.Pp 74.D1 Ic starts Ar date ; 75.D1 Ic ends Ar date ; 76.Pp 77Dates are specified as follows: 78.Pp 79.D1 Ar weekday year Ns / Ns Ar month Ns / Ns Ar day hour : Ns Ar minute : Ns Ar second 80.Pp 81The weekday is present to make it easy for a human to tell when a 82lease expires \- it's specified as a number from zero to six, with zero 83being Sunday. 84The day of week is ignored on input. 85The year is specified with the century, so it should generally be four digits 86except for really long leases. 87The month is specified as a number starting with 1 for January. 88The day of the month is likewise specified starting with 1. 89The hour is a number from 0 to 23, the minute a number from 0 to 59, 90and the second also a number from 0 to 59. 91.Pp 92Lease times are specified in Coordinated Universal Time (UTC), not in the 93local time zone. 94.Pp 95The MAC address of the network interface that was used to acquire the 96lease is recorded with the 97.Ic hardware 98statement: 99.Pp 100.D1 Ic hardware Ar hardware-type mac-address ; 101.Pp 102The MAC address is specified as a series of hexadecimal octets, 103separated by colons. 104.Pp 105If the client uses a client identifier to acquire its address, the 106client identifier is recorded using the 107.Ic uid 108statement: 109.Pp 110.D1 Ic uid Ar client-identifier ; 111.Pp 112The client identifier is recorded as a series of hexadecimal octets, 113regardless of whether the client specifies an ASCII string or uses the 114newer hardware type/MAC address format. 115.Pp 116If the client sends a hostname using the 117.Ic Client Hostname 118option, as specified in some versions of the DHCP-DNS Interaction draft, that 119hostname is recorded using the 120.Ic client-hostname 121statement. 122.Pp 123.D1 Ic client-hostname Qq Ar hostname ; 124.Pp 125If the client sends its hostname using the 126.Ic Hostname 127option, it is recorded using the 128.Ic hostname 129statement. 130.Pp 131.D1 Ic hostname Qq Ar hostname ; 132.Pp 133The DHCP server may determine that a lease has been misused in some 134way, either because a client that has been assigned a lease NAKs it, 135or because the server's own attempt to see if an address is in use 136prior to reusing it reveals that the address is in fact already in 137use. 138In that case, the 139.Ic abandoned 140statement will be used to indicate that the lease should not be reassigned. 141.Pp 142.D1 Ic abandoned ; 143.Pp 144Abandoned leases are reclaimed automatically. 145When a client asks for a new address, and the server finds that there 146are no new addresses, it checks to see if there are any abandoned leases, 147and allocates the least recently abandoned lease. 148The standard mechanisms for checking for lease address conflicts are still 149followed, so if the abandoned lease's IP address is still in use, 150it will be reabandoned. 151.Pp 152If a client 153.Em requests 154an abandoned address, the server assumes that the reason the address was 155abandoned was that the lease file was corrupted, and that the client is 156the machine that responded when the lease was probed, 157causing it to be abandoned. 158In that case, the address is immediately assigned to the client. 159.Sh FILES 160.Bl -tag -width Ds -compact 161.It Pa /var/db/dhcpd.leases 162.El 163.Sh SEE ALSO 164.Xr dhcp-options 5 , 165.Xr dhcpd.conf 5 , 166.Xr dhcpd 8 167.Sh STANDARDS 168.Rs 169.%A R. Droms 170.%D March 1997 171.%R RFC 2131 172.%T Dynamic Host Configuration Protocol 173.Re 174.Pp 175.Rs 176.%A S. Alexander 177.%A R. Droms 178.%D March 1997 179.%R RFC 2132 180.%T DHCP Options and BOOTP Vendor Extensions 181.Re 182.Sh AUTHORS 183.An -nosplit 184.Xr dhcpd 8 185was written by 186.An Ted Lemon Aq Mt mellon@vix.com 187under a contract with Vixie Labs. 188.Pp 189The current implementation was reworked by 190.An Henning Brauer Aq Mt henning@openbsd.org . 191