logging lease expiration time
tom at calixo.net
Fri Sep 27 10:35:51 UTC 2013
> Unable to test it myself right now, but could you try "config-option
> default-lease-time", cf. man dhcp-eval?
Oh, I didn't see this when reading the man but sadly it is still a no
go: "[..] no option named default-lease-time in space dhcp"
I wonder what is "space dhcp" though.
> [..] dhcp.leases is probably the best bet even though it's a pain.
Yes, sadly it's pobably the only solution.
But it's sad especially when you realise that you can have many leases
for the same IP. I wonder how and when the garbage collector kicks in
(man dhcpd.leases does not explain it). As an experiment, I tried a
max-lease-time of 60sec. It does not go over 90 to 100 entries for the
same IP in dhcpd.leases. If only dhcpd.leases could immediately remove
duplicates. Obviously in my production environment I won't have a such
lease time but still. I guess the authors had their reasons to do it
that way. I cannot read ISC dhcpd code, it's too complex for me, far too
many structures for my brain.
In order to prevent the lease database from growing without bound, the
file is rewritten from time to time. First, a temporary lease
database is created and all known leases are dumped to it. Then, the
old lease database is renamed /var/lib/dhcpd/dhcpd.leases~. Finally,
the newly written lease database is moved into place.
The lease file is a log-structured file - whenever a lease changes, the
contents of that lease are written to the end of the file. This means
that it is entirely possible and quite reasonable for there to be two
or more declarations of the same lease in the lease file at the same
time. In that case, the instance of that particular lease that
appears last in the file is the one that is in effect.
More information about the dhcp-users