DHCP Lease Renewals
dhcp1 at thehobsons.co.uk
Fri Jul 15 11:50:00 UTC 2016
Bob McDonald <bmcdonaldjr at gmail.com> wrote:
> However, what happens if the client leaves the network before T1 and then returns before lease expiration? Does the client renew the existing lease? What's the sequence? (Probably clear to most, just not to me...)
As already said, it's highly implementation specific.
Devices (eg printers) without a real time clock, persistent storage, etc will simply startup "cold" and do a full DORA sequence. Most modern OSs on systems with real time clock etc will take some shortcuts. From observations, the steps taken seem to be some combination of :
- Try a broadcast renewal request.
- Do an ARP check and see if you have the same router - if you do, carry on using the same lease.
- Some other means of seeing if you seem to be on the same network (I suspect simply seeing if the gateway IP is active). I include this because I've seen issues with Windows laptops where the home network has the same subnet as the office network, and the laptop uses the lease it got from the home network in the office.
Generally, if you assume that most OSs will resume using an unexpired lease if they think they are on the same network - while also doing some DHCP broadcasts to check - you won't be far wrong.
> I'm pondering a lease time of 20 hours. For subnets where the population of devices isn't guaranteed to be fairly static (e.g. laptops connecting via wires to networks) that is. This would allow a "normal" work shift to expire before the T1 of 10 hours and expire the lease before the next shift starts.
There's no problem really. I generally use leases of several days, or even weeks.
If the lease end time hasn't passed, then the lease is still valid and the server won't give the address to another client. If the end time has passed, the client *shouldn't* attempt to continue using it until it's had a renewal. Using a longer lease such that it doesn't expire overnight (or across weekends) does generally allow clients to connect more quickly as they can take the shortcut (determine that they are on the same network) and connect while waiting for the DHCP service to renew the lease.
In terms of lease times, there's no "right" answer.
As long as you aren't short of addresses, longer leases will give stability and minimise DHCP server load. In high turnover situations, shorter lease times allow better use of addresses (no point tying up an address for that phone that passed through reception 2 days ago and isn't going to be seen again !)
More information about the dhcp-users