Setting a host lease time via OMAPI
dhcp1 at thehobsons.co.uk
Fri Mar 4 07:50:52 UTC 2016
Julien <jsemaan at inverse.ca> wrote:
> Now, the goal of this is not to affect the current lease but to affect future leases.
I guessed that
> Maybe a bit of context will help.
> We have a network which is used for captive portal registration, when you are done registering, you leave this network (through a VLAN change).
> The lease time is set to 30 seconds so that the device tries to renew its IP in the new network fast (and then fail, and get the proper IP)
> Now, some devices connect to the network and stay there for days, months without doing anything else than getting DHCP and without trying to register.
> We would like these devices to have a lease length that is higher than the other ones so that it reduces the load on the DHCP server.
> This above is determined at runtime since the detection occurs after the DHCP server has started, thus the need for it to occur dynamically through the OMAPI or another mean.
As I wrote, I'm not sure that this will help. I'd suggest setting up a test lab and try it - my feeling is that when a client renews, the lease length it's given will depend on the rules for assigning lease lengths, not the length of it's current lease. So when you've lengthened a lease, the client renews, the longer lease is "forgotten about" and a replacement is done for 30s again.
Could you use classes instead. Assign these devices to a specific class (via OMAPI) and configure that class to have longer leases ?
Or perhaps re-assign the client to a "never never land" VLAN with different lease length rules (but still stuck behind the registration portal) ?
More information about the dhcp-users