dhcpd.conf logical hierachy

Narcis Garcia informatica at actiu.net
Wed Oct 18 15:43:04 UTC 2017


As I've understood for my poor english, [subnet] declaration has no much
sense because both subnet and netmask are determined by incoming
interface's data.

Then I suppose this specification structure with a group should be better:

authoritative;
server-name "director.example.net";
group MyInterface1 {
        option routers 172.16.20.100;
        option broadcast-address 172.16.255.255;
        option domain-name-servers 172.16.21.61;
        pool {
                # IP range to be assigned dinamically
                range 172.16.20.150 172.16.20.189;
                allow unknown-clients;
        }
        pool {
                # IP ranges to be assigned statically
                range 172.16.20.0 172.16.20.149;
                range 172.16.20.190 172.16.20.255;
                deny unknown-clients;
                host printer_1 {
                        hardware ethernet 00:11:22:33:44:55;
                        fixed-address 172.16.20.201;
                }
        }
}



El 16/10/17 a les 10:35, Simon Hobson ha escrit:
> Narcis Garcia <informatica at actiu.net> wrote:
> 
>> Do you mean the [group] outside of [subnet] inherits parameters from
>> previous clauses?
> 
> No
> 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.
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
> 


More information about the dhcp-users mailing list