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