DHCP clients renewing early

I have my DHCP leases set for 12h. I have been noticing that clients are renewing their leases before the 12 hours pass. I can see users as they connect each morning and the DHCP time remaining will be something like 11h 55m 12s. Later on, maybe a few hours later, some clients that have been here since morning will now show a time remaining like 11h 20m 45s....like they just renewed.

How is this happening?

This the expected behaviour: clients never wait for the lease to expire before renewing; otherwise, they will have to stop using the assigned IP address during the renewing process.

  • There's the "lease time": The time span a lese is assigned to a certain IP, basically for the client to rely on.
  • There's the "renewal time" (T1): The time span after which the client should ask the server if the IP is still valid. It can be configured in dnsmasq (but not through UCI afaik). If not configured, that's 50% of lease time. So if you configure 12h, every client asks every 6h if the IP is still assigned to him.
  • There's "rebinding time" (T2). From T1 to T2, the client tried to renew the existing IP. After T2 has passed, the client stops sending "renew" requests but instead starts sending regular DHCP requests. Here the client assumes the DHCP server will no longer be able to renew the existing lease (maybe the server is off, or the given IP is somehow blacklisted, otherwises occupied or whatever) and starts asking for any available IP. The T2, just as the T1, can be configured in dnsmasq but not via UCI. If not configured, T2 is 7/8 of the lease time.

If you set lease time to 12h, then T1 is 6h and T2 is 10,5h.

  • As long as you keep your DHCP server up and running, every client asks every 6 hours if the given IP is still valid.
  • Now you turn our DHCP server off.
  • After 6h maximum, the "is this still valid" request will not be responded positive to.
    • Maximum means: According to statistics, most of your clients are right in the middle of such a 6h block and thus will know about that fact after 3 hours.
  • 10.5h after the last request was responded positive to, the clients stop trying to renew and request new IPs.
    • If, according to statistics, most of your clients were right in the middle of the 6h T1 interval, that means it will happen most likely 7.5h (T2 - 0.5*T1) after you unplugged our DHCP server.
  • If you don't set up a new DHCP server within lease time, clients keep using their old IPs until the lease is over and then start to deconfigure networking.
    • So according to statistics: If most of your clients where right in the middle of a T1 block, your network stops working 9h (lease - 0.5*T1) after you unplug your DHCP.
  • If you provide a new DHCP server between T2 and Lease End, clients just reconfigure their network. Depending on the applications you run, there's a chance users don't even notice.

So: That's completely expected, and its even something you can set up in your router if you want.

Thank you for the detailed reply. In my case, it may not be this T1 or T2 time. For example, a client just entered the building and when I checked after several minutes he had time remaining 11h 56m 3s. This looks good. After about 1 hour, I checked again and now that same client has 11h 59m 43s left. So within that short of a span, the client renewed. Is this something I did not understand in your reply or is something different happening here?

Two scenarios here:

  • Clients do whatever they want, and renew before they are expected to renew.
  • Clients disconnect and connect back again, issuing a new request.

I just did a test and it appears that when a client loses connection to the WiFi and then re-connects, the lease time resets. I think that is what is happening here when I see these short spans. Thanks.