03-03-2018 08:38 PM - edited 03-03-2018 08:39 PM
Say there is a DHCP Range 192.168.10.30 - 192.168.10.50
How does the DHCP server select the available ip address to be send to clients? I don't think the DHCP server will use the first available ip address but instead it will select randomly from the range? Can it distribute ip address to clients based on the next available ip address? Like first 30, 31, 32 so on..
Solved! Go to Solution.
03-03-2018 08:59 PM
There is a workflow behind this process which is answered through numerous articles in the Infoblox knowledge base. Keeping it simple- the DHCP server will provide IP's from the highest number on down after doing a ping test (by default) to verify that the IP is in fact free on the network. Any IP's that are detected as already in use (either by the server or the client) will be marked as 'abandoned' and the server will only attempt to use those IP's again if it cycles through the entire range of IP's.
03-04-2018 02:59 AM
Thanks Tony. I understand the flow but assuming that all IP's in the range are all available and as your advised if I understand it correctly, the DHCP server will provide IP's from the highest number. I did some test of it for a few windows xp machines and I don't see that the DHCP server will base it from the highest IP but it is a random selection. sometimes it is from the lowest ip address, sometimes from the highest, and in the middle, sometimes sequentially 1, 2 then skip to 7 then back down to 3...
03-04-2018 03:04 AM
While doing some research, I found this from the isc.org site and it says the following.
The DHCP server generates the list of available IP addresses from a hash table. This means that the addresses are not sorted in any particular order, and so it is not possible to predict the order in which the DHCP server will allocate IP addresses.
03-05-2018 03:30 AM
I just wanted to hop in with a reply. From the NIOS administrator guide 8.1, I see a statement, ‘If you do not apply a filter, the NIOS appliance assigns addresses from the highest address range to the lowest range and within each range from the highest address to the lowest address. That is, the appliance chooses the range with the highest addresses first (that is, closest to 255) and begins assigning addresses exclusively from that range, starting with the highest address and finishing with the lowest (closest to 0)’ .
In addition to this it also states that, ‘After the DHCP server runs for a while, it assigns leases based on when it last used addresses, and not just on their positions in the range.’
So it simply pulls the first lease off the head of the free (or backup) linked list. If there aren't any free leases, it then goes to the first lease in the abandoned linked list. Those linked lists are maintained in sorted order based on the end time of the lease such that the oldest free leases are first. When dhcpd starts up with a virgin pool the leases all have the same ‘ends time’ and are added to the head of the list in IP address order. The end result of this is when all the leases are added the highest IP address lease is first. As leases are expired they are added to the tail of the free list. This allows dhcpd to allocate the oldest free leases before newer ones. So to cut short, although we can anticipate leases to be handed out from Highest address to the lowest address in a range initially, its something which can change over time in a busy environment. In the grand scheme of things it really doesn't matter how dhcpd allocates leases in a pool as long as they are allocated and managed correctly. There can be some concern regarding the predictive nature of allocations in a virgin pool but once things get going the allocations do randomize out some with client affinity being the biggest hindrance to that.
With regards to the test that you did, I don’t know whether that was a newly created DHCP network/range or the NIOS version. But if you could try a fresh network/range, my expectation would be to see a lease allocation from Highest -> Lowest in the range initially.
Hope this would address your concerns.
03-05-2018 03:52 AM
Thanks Mohammed! For some reason, the previous testing I did shows different results. Now I did a fresh network and dhcp range and tested in 3 windows machines and it gets ip address from the highest ip address. Happy now!
@Tony, my bad, you are right. Thanks for your help.