IP Pools with preference/priority on ISC DHCP Server

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Oct 29 11:38:11 UTC 2015


Muhammad Faisal <faisalusuf at yahoo.com> wrote:

> Is there any way we can define two pools for a subnet or a shared network with preference. The scenario is we have two pools we want first pool to be used but in case of spill over another defined pool to be used. How we can set the priority?

That isn't supported.
All pools have equal priority* and are considered equivalent (as in, any client can have any available address) unless allow/deny statements say otherwise.

* The only exception to that is while there are "never used" addresses in which case these will be given to new clients in an order defined by the way the code happens to work. At present this is "top down" (highest numerical value first) but that is undocumented, undefined, and liable to change without notice.

There is one way round this that I can think of, and that's to "fiddle with the leases". It's messy but it would achieve what you want.

Monitor the pool you want to have priority, and as long as there are currently free addresses in there then do one of :

1) Set a small number of them to "never used" - ie delete them.
If the "top down" allocation order suits you (ie the priority pool is numerically higher than the other pool), then any new clients coming along will get one of those "never used" addresses. You will also need to delete any leases in the second pool as they expire - otherwise those clients will always get the same address.

2) Fiddle with the leases so that the "least recently used" algorithm will always pick an address from the priority pool - eg set the expired time a long time in the past. You will also need to maintain dummy leases in the second pool so that those addresses always come last in the "least recently used" calculation.

Option 2 is probably easiest. You could create dummy leases for all addresses you want to be lower priority, and keep adjusting the expired time to be very recent so that expired leases in the priority pool will get used in preference. You'll also need to remove any real leases in the second pool when they expire (as long as there are spare address in the first pool) so that clients will switch back to the priority pool when they come back.


But really, it's a lot of work and hassle - and for what ?
Either the addresses in the second pool "work" - in which case, what's wrong with using them. Or they don't "work" - in which case you have a bigger problem.

Perhaps if you explained what the requirements are, rather than how you think you want to achieve it, there might be other ideas.


More information about the dhcp-users mailing list