what is the "dhcpd.leases" rotate period

Simon Hobson dhcp1 at thehobsons.co.uk
Wed Sep 5 18:20:07 UTC 2007

Sébastien CRAMATTE wrote:

>What is the "dhcpd.leases" rotate period
>I've build a lease parser in perl  and I've remarked that dhcpd.leases
>fille size still very small ... seems to be rotated ...
>Someone can give me some explanations ?

You mean the lease file rotation ? This has been 
covered many times on this list, though I'm not 
sure it's in the documentation.

The working database for the server is held in 
memory, the file on disk is purely a backup plus 
persistent storage across restarts. The file is 
read during startup and then not read again, and 
updates are added to the end - ie it is a log of 
transactions. Lease record are NEVER updated in 
the file, only new records added. To avoid 
infinite growth, the server periodically cleans 
up the file by :

1) Writing a new file from it's in memory database.
2) Renames the existing lease file.
3) Renames the new file to dhcpd.leases.

The period is fixed in the source code at 1 hour.

If you are writing a program that parses the 
leases file, you need to be aware that each 
iteration of the file will not contain any 
history of events prior to the last rotation (ie 
only the last state of any lease is held). If you 
are trying to extract a record of transactions 
then it may be more accurate to parse the backup 
file after each rotation rather than try to catch 
updates that occur just before the file is 

More information about the dhcp-users mailing list