Latest lease entry not the one offered to the client

Klemen Sladic gosturnca at
Tue Sep 8 23:51:21 UTC 2020

Thank you very much Niall.

Your explanation is very useful and answered my open questions.
I made a shell script that parses the file to do what I need.


On Wed, Aug 26, 2020 at 9:59 PM Niall O'Reilly <niall.oreilly at> wrote:

> I haven't seen follow-up to this yet, so here is my tuppence-worth.
> On 18 Aug 2020, at 4:07, ksladic wrote:
> Regarding lease file cleanup:
> 1. Does it remove all expired leases?
> No, because removing them would not be consistence with the
> service definition <>:
> "The
> allocation mechanism (the collection of DHCP servers) guarantees not
> to reallocate that address within the requested time and
> *attempts to return the same network address each time the client requests
> an address*." (My emphasis)
> This means that an expired lease should be retained for use in case the
> client ever requests it again.
>    1. Does it remove duplicate leases ... keeping only last valid one?
> Yes, but a lease is identified for this purpose by its IP address,
> not by any property of the client, such as MAC address or UUID,
> or so I recall.
> It follows that an expired lease which, because of depletion of the
> lease pool, is assigned to a different client, may lose its association
> with an earlier client.
>    1. In general (before or after lease file cleanup) if I would like to
>    find the latest valid leased IP for a client, is it best to go through
>    whole file and pick valid lease with latest timestamp? Because as I
>    understand I can not rely on the order of leases in the file.
> It's easy but tedious to write a script to do this. I may have one which
> was
> once in production in some backup somewhere, but you can probably code one
> faster than I could find it again.
> I hope this helps.
> Niall O'Reilly
> _______________________________________________
> ISC funds the development of this software with paid support
> subscriptions. Contact us at for more
> information.
> dhcp-users mailing list
> dhcp-users at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the dhcp-users mailing list