dhcpd.conf logical hierachy
dhcp1 at thehobsons.co.uk
Mon Oct 16 08:35:47 UTC 2017
Narcis Garcia <informatica at actiu.net> wrote:
> Do you mean the [group] outside of [subnet] inherits parameters from
> previous clauses?
The config file isn't parsed "top to bottom" in terms of how things are evaluated when a request comes in from a client, or put another way, the order of sections within the file isn't important.
The inheritance is based on scopes. So taking your specific example, printer_1 does a DHCP Discover and the server does two things :
It uses the incoming interface (directly connected clients) or Gateway Interface Address (if coming via a relay) to identify the subnet (or shared network) to which the client is connected.
It evaluates classes and host declarations to see if it matches - in this case it will match a host declaration with a fixed address.
As the fixed address is valid for the subnet to which the client is connected (assuming it's plugged into the right network) then the address will be assigned, the client will be "put into" that subnet, and all the subnet (and possibly shared network) options will be applied. Then any group and host declaration options will be applied.
If you were to plug the printer into a different network (subnet) served by the same server, then the fixed address assignment would be ignored (not valid for the subnet) but other options declared in the host declaration and group would still be applied and over-ride the subnet/shared network/global options.
I would recommend that you find a copy of "The DHCP Handbook" by Ralph Droms and Ted Lemon which is more or less the definitive guide to how DHCP works - and specifically the ISC server. It's in it's second edition, but that only really adds the failover stuff so the original version will cover what you need.
> Anyway, is this a valid (or best) setup to split dynamic and static
> definitions for same subnet?
Yes. You can mix and match dynamic pools and fixed addresses as much as you want as long as there is no overlap. As I showed earlier, if you want a fixed address in the middle of a range then you just have to split the range to omit that address from it - you can have multiple ranges in a pool.
More information about the dhcp-users