]> git.ipfire.org Git - thirdparty/dhcp.git/blame_incremental - server/dhcpd.leases.5
Update README - added section on Release status which was in the TOC
[thirdparty/dhcp.git] / server / dhcpd.leases.5
... / ...
CommitLineData
1.\" dhcpd.leases.5
2.\"
3.\" Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
4.\" Copyright (c) 1996-2003 by Internet Software Consortium
5.\"
6.\" This Source Code Form is subject to the terms of the Mozilla Public
7.\" License, v. 2.0. If a copy of the MPL was not distributed with this
8.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
16.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.\" Internet Systems Consortium, Inc.
19.\" PO Box 360
20.\" Newmarket, NH 03857 USA
21.\" <info@isc.org>
22.\" https://www.isc.org/
23.\"
24.\" $Id: dhcpd.leases.5,v 1.17 2011/09/19 00:24:50 sar Exp $
25.\"
26.TH dhcpd.leases 5
27.SH NAME
28dhcpd.leases - DHCP client lease database
29.SH DESCRIPTION
30The Internet Systems Consortium DHCP Server keeps a persistent
31database of leases that it has assigned. This database is a free-form
32ASCII file containing a series of lease declarations. Every time a
33lease is acquired, renewed or released, its new value is recorded at
34the end of the lease file. So if more than one declaration appears
35for a given lease, the last one in the file is the current one.
36.PP
37When dhcpd is first installed, there is no lease database. However,
38dhcpd requires that a lease database be present before it will start.
39To make the initial lease database, just create an empty file called
40DBDIR/dhcpd.leases. You can do this with:
41.PP
42.nf
43 touch DBDIR/dhcpd.leases
44.fi
45.PP
46In order to prevent the lease database from growing without bound, the
47file is rewritten from time to time. First, a temporary lease
48database is created and all known leases are dumped to it. Then, the
49old lease database is renamed DBDIR/dhcpd.leases~. Finally, the
50newly written lease database is moved into place.
51.PP
52In order to process both DHCPv4 and DHCPv6 messages you will need to
53run two separate instances of the dhcpd process. Each of these
54instances will need it's own lease file. You can use the \fI-lf\fR
55option on the server's command line to specify a different lease file
56name for one or both servers.
57.SH FORMAT
58Lease descriptions are stored in a format that is parsed by the same
59recursive descent parser used to read the
60.B dhcpd.conf(5)
61and
62.B dhclient.conf(5)
63files. Lease files can contain lease declarations, and also group and
64subgroup declarations, host declarations and failover state
65declarations. Group, subgroup and host declarations are used to
66record objects created using the OMAPI protocol.
67.PP
68The lease file is a log-structured file - whenever a lease changes,
69the contents of that lease are written to the end of the file. This
70means that it is entirely possible and quite reasonable for there to
71be two or more declarations of the same lease in the lease file at the
72same time. In that case, the instance of that particular lease that
73appears last in the file is the one that is in effect.
74.PP
75Group, subgroup and host declarations in the lease file are handled in
76the same manner, except that if any of these objects are deleted, a
77\fIrubout\fR is written to the lease file. This is just the same
78declaration, with \fB{ deleted; }\fR in the scope of the
79declaration. When the lease file is rewritten, any such rubouts that
80can be eliminated are eliminated. It is possible to delete a
81declaration in the \fBdhcpd.conf\fR file; in this case, the rubout
82can never be eliminated from the \fBdhcpd.leases\fR file.
83.SH COMMON STATEMENTS FOR LEASE DECLARATIONS
84While the lease file formats for DHCPv4 and DHCPv6 are different
85they share many common statements and structures. This section
86describes the common statements while the succeeding sections
87describe the protocol specific statements.
88.PP
89.B Dates
90.PP
91A \fIdate\fR is specified in two ways, depending on the configuration
92value for the \fBdb-time-format\fR parameter. If it was set to \fIdefault\fR,
93then the \fIdate\fR fields appear as follows:
94.PP
95.I weekday year\fB/\fImonth\fB/\fIday hour\fB:\fIminute\fB:\fIsecond\fR
96.PP
97The weekday is present to make it easy for a human to tell when a
98lease expires - it's specified as a number from zero to six, with zero
99being Sunday. The day of week is ignored on input. The year is
100specified with the century, so it should generally be four digits
101except for really long leases. The month is specified as a number
102starting with 1 for January. The day of the month is likewise
103specified starting with 1. The hour is a number between 0 and 23, the
104minute a number between 0 and 59, and the second also a number between
1050 and 59.
106.PP
107Lease times are specified in Universal Coordinated Time (UTC), not in
108the local time zone. There is probably nowhere in the world where the
109times recorded on a lease are always the same as wall clock times. On
110most unix machines, you can display the current time in UTC by typing
111\fBdate -u\fR.
112.PP
113If the \fBdb-time-format\fR was configured to \fIlocal\fR, then
114the \fIdate\fR fields appear as follows:
115.PP
116 \fBepoch\fR \fI<seconds-since-epoch>\fR\fB; #\fR \fI<day-name> <month-name>
117<day-number> <hours>\fR\fB:\fR\fI<minutes>\fR\fB:\fR\fI<seconds> <year>\fR
118.PP
119The \fIseconds-since-epoch\fR is as according to the system's local clock (often
120referred to as "unix time"). The \fB#\fR symbol supplies a comment that
121describes what actual time this is as according to the system's configured
122timezone, at the time the value was written. It is provided only for human
123inspection.
124.PP
125If a lease will never expire, \fIdate\fR is \fBnever\fR instead of an
126actual date.
127.PP
128.B General Variables
129.PP
130As part of the processing of a lease information may be attached to the
131lease structure, for example the DDNS information or if you specify a
132variable in your configuration file. Some of these, like the DDNS
133information, have specific descriptions below. For others, such as
134any you might define, a generic line of the following will be included.
135.PP
136.B set \fIvariable\fB = \fIvalue\fB;
137.PP
138The \fBset\fR statement sets the value of a variable on the lease.
139For general information on variables, see the \fBdhcp-eval(5)\fR
140manual page.
141.PP
142.B DDNS Variables
143.PP
144.nf
145.B The \fIddns-text\fB and \fIddns-dhcid\fB variables
146.PP
147These variables are used to record the value of the client's identification
148record when the server has updated DNS for a particular lease. The text
149record is used with the interim DDNS update style while the dhcid record
150is used for the standard DDNS update style.
151.PP
152.B The \fIddns-fwd-name\fB variable
153.PP
154This variable records the value of the name used in
155updating the client's A record if a DDNS update has been successfully
156done by the server. The server may also have used this name to
157update the client's PTR record.
158.PP
159.B The \fIddns-client-fqdn\fB variable
160.PP
161If the server is configured both to use the interim or standard DDNS update
162style, and to allow clients to update their own FQDNs, then if the
163client did in fact update its own FQDN, the
164\fIddns-client-fqdn\fR variable records the name that the client has
165indicated it is using. This is the name that the server will have
166used to update the client's PTR record in this case.
167.PP
168.B The \fIddns-rev-name\fB variable
169.PP
170If the server successfully updates the client's PTR record, this
171variable will record the name that the DHCP server used for the PTR
172record. The name to which the PTR record points will be either the
173\fIddns-fwd-name\fR or the \fIddns-client-fqdn\fR.
174.PP
175.B Executable Statements
176.PP
177.B on \fIevents\fB { \fIstatements...\fB }
178The \fBon\fR statement records a list of statements to execute if a
179certain event occurs. The possible events that can occur for an
180active lease are \fBrelease\fR and \fBexpiry\fR. More than one event
181can be specified - if so, the events are separated by '|' characters.
182.PP
183The \fIauthoring-byte-order\fR statement
184.RS 0.25i
185.PP
186.B authoring-byte-order \fR[ \fIbig-endian\fR | \fIlittle-endian\fR ] \fB;\fR
187.PP
188This statement is automatically added to the top of new lease files by
189the server. It indicates the internal byte order of the server. This
190permits lease files generated on a server with one form of byte order
191to be read by a server with a different form. Lease files which do not
192contain this entry are simply treated as having the same byte order as
193the server reading them. If you are migrating lease files generated
194by a server that predates this statement and is of a different byte
195order than the your destination server, you can manually add this
196statement. It must proceed any lease entries. Valid values for this
197parameter are \fIlittle-endian\fR and \fIbig-endian\fR.
198.RE
199.PP
200.SH THE DHCPv4 LEASE DECLARATION
201.PP
202.B lease \fIip-address\fB { \fIstatements...\fB }
203.PP
204Each lease declaration includes the single IP address that has been
205leased to the client. The statements within the braces define the
206duration of the lease and to whom it is assigned.
207.PP
208.nf
209.B starts \fIdate\fB;\fR
210.B ends \fIdate\fB;\fR
211.B tstp \fIdate\fB;\fR
212.B tsfp \fIdate\fB;\fR
213.B atsfp \fIdate\fB;\fR
214.B cltt \fIdate\fB;\fR
215.fi
216.PP
217The start and end time of a lease are recorded using the \fBstarts\fR
218and \fBends\fR statements. The \fBtstp\fR statement is present if
219the failover protocol is being used, and indicates what time the peer
220has been told the lease expires. The \fBtsfp\fR statement is
221also present if the failover protocol is being used, and indicates
222the lease expiry time that the peer has acknowledged.
223The \fBatsfp\fR statement is the actual time sent from the failover
224partner.
225The \fBcltt\fR statement is the client's last transaction time.
226.PP
227See the description of dates in the section on common structures.
228.PP
229.B hardware \fIhardware-type mac-address\fB;\fR
230.PP
231The hardware statement records the MAC address of the network
232interface on which the lease will be used. It is specified as a
233series of hexadecimal octets, separated by colons.
234.PP
235.B uid \fIclient-identifier\fB;\fR
236.PP
237The \fBuid\fR statement records the client identifier used by the
238client to acquire the lease. Clients are not required to send client
239identifiers, and this statement only appears if the client did in fact
240send one. Client identifiers are normally an ARP type (1 for
241ethernet) followed by the MAC address, just like in the \fBhardware\fI
242statement, but this is not required.
243.PP
244The client identifier is recorded as a colon-separated hexadecimal
245list or as a quoted string. If it is recorded as a quoted string and
246it contains one or more non-printable characters, those characters are
247represented as octal escapes - a backslash character followed by three
248octal digits. The format used is determined by the lease-id-format
249parameter, which defaults to octal.
250.PP
251.B client-hostname "\fIhostname\fB";\fR
252.PP
253Most DHCP clients will send their hostname in the \fIhost-name\fR
254option. If a client sends its hostname in this way, the hostname is
255recorded on the lease with a \fBclient-hostname\fR statement. This
256is not required by the protocol, however, so many specialized DHCP
257clients do not send a host-name option.
258.PP
259.nf
260.B binding state \fIstate\fB;
261.B next binding state \fIstate\fB;
262.fi
263.PP
264The \fBbinding state\fR statement declares the lease's binding state.
265When the DHCP server is not configured to use the failover protocol, a
266lease's binding state may be \fBactive\fR, \fBfree\fR or \fBabandoned\fR.
267The failover protocol adds some additional transitional states, as well as
268the \fBbackup\fR state, which indicates that the lease is available
269for allocation by the failover secondary. Please see the \fBdhcpd.conf(5)\fR
270manual page for more information about abandoned leases.
271.PP
272The \fBnext binding state\fR statement indicates what state the lease
273will move to when the current state expires. The time when the
274current state expires is specified in the \fIends\fR statement.
275.PP
276.B rewind binding state \fIstate\fB;
277.PP
278This statement is part of an optimization for
279use with failover. This helps a server rewind a lease to the state most
280recently transmitted to its peer.
281.PP
282.nf
283.B option agent.circuit-id \fIstring\fR;
284.B option agent.remote-id \fIstring\fR;
285.fi
286.PP
287These statements are used to record the circuit ID and remote ID options
288sent by the relay agent, if the relay agent uses the \fIrelay agent
289information option\fR. This allows these options to be used
290consistently in conditional evaluations even when the client is
291contacting the server directly rather than through its relay agent.
292.PP
293.B The \fIvendor-class-identifier\fB variable
294.PP
295The server retains the client-supplied Vendor Class Identifier option
296for informational purposes, and to render them in DHCPLEASEQUERY responses.
297.PP
298.nf
299.B bootp;
300.B reserved;
301.fi
302.PP
303If present, they indicate that the BOOTP and RESERVED failover flags
304(respectively) should be set. BOOTP
305and RESERVED dynamic leases are treated differently than normal dynamic leases,
306as they may only be used by the client to which they are currently allocated.
307.PP
308.B Other
309Additional options or executable statements may be included, see the description
310of them in the section on common structures.
311.RE
312.PP
313.SH THE DHCPv6 LEASE (IA) DECLARATION
314.PP
315.nf
316.B ia_ta \fI IAID_DUID\fB { \fIstatements...\fB }
317.B ia_na \fI IAID_DUID\fB { \fIstatements...\fB }
318.B ia_pd \fI IAID_DUID\fB { \fIstatements...\fB }
319.fi
320.PP
321Each lease declaration starts with a tag indicating the type of the lease.
322ia_ta is for temporary addresses, ia_na is for non-temporary addresses and
323ia_pd is for prefix delegation. Following this tag is the combined IAID
324and DUID from the client for this lease.
325.PP
326The IAID_DUID value is recorded as a colon-separated hexadecimal
327list or as a quoted string. If it is recorded as a quoted string and
328it contains one or more non-printable characters, those characters are
329represented as octal escapes - a backslash character followed by three
330octal digits. The format used is governed by the lease-id-format parameter,
331which defaults to octal.
332.PP
333.B cltt \fIdate\fB;\fR
334.PP
335The \fBcltt\fR statement is the client's last transaction time.
336.PP
337See the description of dates in the section on common structures.
338.PP
339.nf
340.B iaaddr \fIipv6-address\fB { \fIstatements...\fB }
341.B iaprefix \fIipv6-address/prefix-length\fB { \fIstatements...\fB }
342.PP
343Within a given lease there can be multiple iaaddr and iaprefix statements.
344Each will have either an IPv6 address or an IPv6 prefix (an address and
345a prefix length indicating a CIDR style block of addresses). The following
346statements may occur Within each iaaddr or iaprefix.
347.PP
348.B binding state \fIstate\fB;
349.PP
350The \fBbinding state\fR statement declares the lease's binding state.
351In DHCPv6 you will normally see this as \fIactive\fR or \fIexpired\fR.
352.PP
353.B preferred-life \fIlifetime\fB;
354.PP
355The IPv6 preferred lifetime associated with this address, in seconds.
356.PP
357.B max-life \fIlifetime\fB;
358.PP
359The valid lifetime associated with this address, in seconds.
360.PP
361.B ends \fIdate\fB;\fR
362.PP
363The end time of the lease. See the description of dates in the section on
364common structures.
365.PP
366Additional options or executable statements may be included. See the description
367of them in the section on common structures.
368.PP
369.RE
370.SH THE FAILOVER PEER STATE DECLARATION
371The state of any failover peering arrangements is also recorded in the
372lease file, using the \fBfailover peer\fR statement:
373.PP
374.nf
375.B failover peer "\fIname\fB" state {
376.B my state \fIstate\fB at \fIdate\fB;
377.B peer state \fIstate\fB at \fIdate\fB;
378.B }
379.fi
380.PP
381The states of the peer named \fIname\fR is being recorded. Both the
382state of the running server (\fBmy state\fR) and the other failover
383partner (\fIpeer state\fR) are recorded. The following states are
384possible: \fBunknown-state\fR, \fBpartner-down\fR, \fBnormal\fR,
385\fBcommunications-interrupted\fR, \fBresolution-interrupted\fR,
386\fBpotential-conflict\fR, \fBrecover\fR, \fBrecover-done\fR,
387\fBshutdown\fR, \fBpaused\fR, and \fBstartup\fR.
388.RE
389.SH FILES
390.B DBDIR/dhcpd.leases DBDIR/dhcpd.leases~
391.SH SEE ALSO
392dhcpd(8), dhcp-options(5), dhcp-eval(5), dhcpd.conf(5), RFC2132, RFC2131.
393.SH AUTHOR
394.B dhcpd(8)
395is maintained by ISC.
396Information about Internet Systems Consortium can be found at:
397.B https://www.isc.org/