A Question on Dynamic DHCP/DNS IP Lease Renew
dhcp1 at thehobsons.co.uk
Wed Sep 28 21:30:31 UTC 2016
David Li <dlipubkey at gmail.com> wrote:
> My question is: if the server is rebooted, will it come back and be
> assigned the same IP 10.3.2.38 again as long as its MAC stays the
> I tested a few times and it seemed to be the case. Are there any
> circumstances that a different IP will be assigned to the same server?
Yes - mostly.
The server will attempt to give every client the same address as it had previously. If the address has not been reassigned to another client, then this will happen. At this point, it's probably worth setting out the allocation algorithm used by the ISC server (other servers operate differently, and mostly in a non-RFC-compliant manner).
In the following, everything is subject to admin restrictions/policies - eg by allow/deny rules ...
If a client has previously had an address from this server appropriate to the network segment AND that address is still available AND the address is permitted to be allocated to the client THEN the client will be given that address. Otherwise a different address will be allocated as follows :
If there are any "never used" addresses available then one of those will be allocated.
Else an expired lease will be recycled - based on least recently used.
If there are no free leases, then any abandoned leases will be recycled.
If we get to this point, then there's no address available.
So for a device to lose it's address, regardless of how long it's been off the network and it's lease expired, there must have been enough client churn for the address to have been reused in accordance with the above.
Lastly, there is the definition of client. The primary key for the lease database is the Client-ID, and only if that is missing will the client MAC be used. This means that if the Client-ID changes - or if it's missing, the MAC - then the client is deemed to be a different client.
There is also the issue of multiple client OSs. Windows defaults to using the MAC address as Client-ID, most other OSs default to leaving it blank - thus the client will appear as two different clients to the server. Eg when using PXE - at every boot the PXE client gets one address, then the OS gets a different one.
More information about the dhcp-users