<div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote" style=""><div dir="ltr" class="gmail_attr">On Wed, Nov 10, 2021 at 9:18 AM Johannes Midgren <<a href="mailto:johannes@midgren.net">johannes@midgren.net</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"><div dir="ltr"><div>Thanks a lot, Mattias!</div><div><br></div><div>That does answer my question. I guess for now I will have to mitigate the issue in any of the ways I listed in the original post, and when I get the time I might very well write a hook. It's about time I take up my C++ skills :-)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den ons 10 nov. 2021 kl 15:05 skrev Mattias Johansson <<a href="mailto:Mattias.Johansson@varnamoenergi.se" target="_blank">Mattias.Johansson@varnamoenergi.se</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="SV">
<div>
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>I found this<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><a href="https://lists.isc.org/pipermail/kea-users/2018-September/001997.html" target="_blank">[Kea-users] Enable lease affinity with MySQL backend (isc.org)</a><u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>”Kea has a built in support for keeping an expired lease around for a<u></u><u></u></span></p>
<p class="MsoNormal"><span>configurable amount of time, which is driven by<u></u><u></u></span></p>
<p class="MsoNormal"><span>"expired-leases-processing" parameters described in the Kea User's<u></u><u></u></span></p>
<p class="MsoNormal"><span>Guide. In other words, if the lease expires (client does not renew the<u></u><u></u></span></p>
<p class="MsoNormal"><span>lease), the server won't remove this lease from the database<u></u><u></u></span></p>
<p class="MsoNormal"><span>immediately, but will rather wait a configured amount of time before it<u></u><u></u></span></p>
<p class="MsoNormal"><span>removes it. This doesn't preclude other clients from getting the lease<u></u><u></u></span></p>
<p class="MsoNormal"><span>if they request it, but in most cases the expired lease will simply be<u></u><u></u></span></p>
<p class="MsoNormal"><span>re-assigned to the client who had been using it before.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Having said that, this doesn't work for cases when the client sends a<u></u><u></u></span></p>
<p class="MsoNormal"><span>Release to indicate that it stops using the lease. In such cases, the<u></u><u></u></span></p>
<p class="MsoNormal"><span>lease is removed from the database upon receiving the Release. There are<u></u><u></u></span></p>
<p class="MsoNormal"><span>no configuration knobs to keep the lease in the database for the client<u></u><u></u></span></p>
<p class="MsoNormal"><span>after the client releases the lease.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>The only possibility I see to address your use case at the moment is to<u></u><u></u></span></p>
<p class="MsoNormal"><span>write a simple hooks library which drops the received Release packets.<u></u><u></u></span></p>
<p class="MsoNormal"><span>The server won't process them and the leases will be left to expire in<u></u><u></u></span></p>
<p class="MsoNormal"><span>the database. When the client reboots it should get the same lease. That<u></u><u></u></span></p>
<p class="MsoNormal"><span>involves C++ coding though.”<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>sounds like what you’re experiencing.
<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<div>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Från:</b> Kea-users <<a href="mailto:kea-users-bounces@lists.isc.org" target="_blank">kea-users-bounces@lists.isc.org</a>> <b>
För </b><a href="mailto:egor.grijuc@orange.com" target="_blank">egor.grijuc@orange.com</a><br>
<b>Skickat:</b> den 10 november 2021 14:52<br>
<b>Till:</b> Johannes Midgren <<a href="mailto:johannes@midgren.net" target="_blank">johannes@midgren.net</a>>; <a href="mailto:kea-users@lists.isc.org" target="_blank">kea-users@lists.isc.org</a><br>
<b>Ämne:</b> Re: [Kea-users] Lease affinity of released leases<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-US">Maybe a host reservation is a solution?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Kea-users <<a href="mailto:kea-users-bounces@lists.isc.org" target="_blank">kea-users-bounces@lists.isc.org</a>>
<b>On Behalf Of </b>Johannes Midgren<br>
<b>Sent:</b> Wednesday, 10 November 2021 15:47<br>
<b>To:</b> <a href="mailto:kea-users@lists.isc.org" target="_blank">kea-users@lists.isc.org</a><br>
<b>Subject:</b> [Kea-users] Lease affinity of released leases<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">TLDR: How do I make KEA offer the same IP to a host that is rebooted and that releases its IP address while shutting down?<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I have recently started to use KEA on my home network. I love the fact that I can control its configuration through Ansible and all the possibilities the REST API gives, so I'm very glad that I found the project!<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">One thing that I still have not been able to get the way I prefer it though, is to have lease affinity in all cases. That is, I would like for a client to always get the same IP address when it reconnects (as long as
it's still available of course). I have read the chapter about Lease Expiration (and Affinity) in the manual and I'm not sure the case I'm looking for is covered. The manual talks about expired leases, but I would like to have affinity also in the case that
the lease has been released rather than expired. Using a packet sniffer I can see that clients tend to properly release the DHCP lease when being rebooted and when it gets online again it does a DHCP Discover and is offered a new IP address by the KEA DHCP4
server.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Does anyone know if KEA is supposed to (or rather can be made to) work the way I intend it to or if lease affinity by design is only supposed to work for expired, thus not released, leases? (Or maybe something is wrong
with my setup and this should actually work?)<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">The problem I have is that cached DNS entries make hosts unavailable for some time after they are restarted - they are "sought for" by their old IP. I guess I can mitigate the issue by setting a very low TTL in my DNS
configuration, but I would prefer to let KEA hold leases for a long time and reuse them instead. Another way would of course be to make reservations for all hosts where this matters, but that prevents the automation that I try to use KEA for.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I have been playing with the expired-leases-processing configuration for the DHCP4 server, and I currently have this:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-family:"Courier New";color:black;background:none 0% 0% repeat scroll white" lang="EN-US"> "expired-leases-processing": {
</span><span style="font-family:"Courier New"" lang="EN-US"><br>
"flush-reclaimed-timer-wait-time": 300, <br>
"hold-reclaimed-time": 604800, <br>
"max-reclaim-leases": 100, <br>
"max-reclaim-time": 250, <br>
"reclaim-timer-wait-time": 180, <br>
"unwarned-reclaim-cycles": 5 <br>
},</span><span lang="EN-US"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I'm running KEA 1.8 (installed from CloudSmith repos) on CentOS Stream 8. I use the memfile lease-database, have DHCP-DDNS setup and I use the HA hook (with one primary, one standby and one backup host).<u></u><u></u></span></p>
</div>
</div>
<pre><span lang="EN-US">_________________________________________________________________________________________________________________________<u></u><u></u></span></pre>
<pre><span lang="EN-US"><u></u> <u></u></span></pre>
<pre><span lang="EN-US">Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc<u></u><u></u></span></pre>
<pre><span lang="EN-US">pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler<u></u><u></u></span></pre>
<pre><span lang="EN-US">a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,<u></u><u></u></span></pre>
<pre><span lang="EN-US">Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.<u></u><u></u></span></pre>
<pre><span lang="EN-US"><u></u> <u></u></span></pre>
<pre><span lang="EN-US">This message and its attachments may contain confidential or privileged information that may be protected by law;<u></u><u></u></span></pre>
<pre><span lang="EN-US">they should not be distributed, used or copied without authorisation.<u></u><u></u></span></pre>
<pre><span lang="EN-US">If you have received this email in error, please notify the sender and delete this message and its attachments.<u></u><u></u></span></pre>
<pre><span lang="EN-US">As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.<u></u><u></u></span></pre>
<pre><span lang="EN-US">Thank you.<u></u><u></u></span></pre>
</div>
</div>
</blockquote></div><br></blockquote><div><br></div><div>You might want to see if there is any option on the client to tell it not to "release" when shutting down.</div><div><br></div><div>-- </div><div>Bob Harold</div><div> </div></div><input name="virtru-metadata" type="hidden" value="{"email-policy":{"state":"closed","expirationUnit":"days","disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"enableNoauth":false,"persistentProtection":false,"expandedWatermarking":false,"expires":false,"isManaged":false},"attachments":{},"compose-id":"20","compose-window":{"secure":false}}"></div>