logging lease expiration time

Peter Rathlev peter at rathlev.dk
Fri Sep 27 14:54:56 UTC 2013


On Fri, 2013-09-27 at 20:35 +1000, tom wrote:
> 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.

And "default-lease-time" is explicitly defined in this scope?

> > [..] 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.

You always have just one lease per IP address. Only the most recent
(i.e. most towards the end of the lease file) lease is relevant.

> I wonder how and when the garbage collector kicks in 
> (man dhcpd.leases does not explain it).

Writing out the whole lease database at every change is too ineffective,
so records are just appended to the file. Every once in a while the
whole file is overwritten. The leases file should thus be read from the
beginning with every duplicate lease (IP address) record overwriting the
previous. This should not be too difficult to handle in a parser.

> 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.

ISC DHCPd conforms to the RFC by never ACK'ing a lease unless it has
been written to the file. Overwriting the whole file at every lease ACK
would generate much too much disk I/O.

-- 
Peter




More information about the dhcp-users mailing list