<div dir="ltr"><div>Thank you very much Niall.</div><div><br></div><div>Your explanation is very useful and answered my open questions.<br></div><div>I made a shell script that parses the file to do what I need.</div><div><br></div><div>Regards,</div><div>Klemen<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 26, 2020 at 9:59 PM Niall O'Reilly <<a href="mailto:niall.oreilly@ucd.ie">niall.oreilly@ucd.ie</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">I haven't seen follow-up to this yet, so here is my tuppence-worth.</p>
<p dir="auto">On 18 Aug 2020, at 4:07, ksladic wrote:</p>
<blockquote style="border-left:2px solid rgb(119,119,119);color:rgb(119,119,119);margin:0px 0px 5px;padding-left:5px">
<p dir="auto">Regarding lease file cleanup:<br>
1. Does it remove all expired leases?</p>
</blockquote>
<p dir="auto">No, because removing them would not be consistence with the<br>
<a href="https://tools.ietf.org/html/rfc2131#section-2.2" style="color:rgb(57,131,196)" target="_blank">service definition</a>:</p>
<p dir="auto">"The<br>
allocation mechanism (the collection of DHCP servers) guarantees not<br>
to reallocate that address within the requested time and <strong>attempts to<br>
return the same network address each time the client requests an<br>
address</strong>." (My emphasis)</p>
<p dir="auto">This means that an expired lease should be retained for use in case the<br>
client ever requests it again.</p>
<blockquote style="border-left:2px solid rgb(119,119,119);color:rgb(119,119,119);margin:0px 0px 5px;padding-left:5px">
<ol>
<li value="2">Does it remove duplicate leases ... keeping only last valid one?</li>
</ol>
</blockquote>
<p dir="auto">Yes, but a lease is identified for this purpose by its IP address,<br>
not by any property of the client, such as MAC address or UUID,<br>
or so I recall.</p>
<p dir="auto">It follows that an expired lease which, because of depletion of the<br>
lease pool, is assigned to a different client, may lose its association<br>
with an earlier client.</p>
<blockquote style="border-left:2px solid rgb(119,119,119);color:rgb(119,119,119);margin:0px 0px 5px;padding-left:5px">
<ol>
<li value="3">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.</li>
</ol>
</blockquote>
<p dir="auto">It's easy but tedious to write a script to do this. I may have one which was<br>
once in production in some backup somewhere, but you can probably code one<br>
faster than I could find it again.</p>
<p dir="auto">I hope this helps.</p>
<p dir="auto">Niall O'Reilly</p>
</div>
</div>
</div>
_______________________________________________<br>
ISC funds the development of this software with paid support subscriptions. Contact us at <a href="https://www.isc.org/contact/" rel="noreferrer" target="_blank">https://www.isc.org/contact/</a> for more information.<br>
<br>
dhcp-users mailing list<br>
<a href="mailto:dhcp-users@lists.isc.org" target="_blank">dhcp-users@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/dhcp-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a><br>
</blockquote></div>