dhcpd.conf logical hierachy

Simon Hobson dhcp1 at thehobsons.co.uk
Sat Oct 14 16:11:52 UTC 2017


Narcis Garcia <informatica at actiu.net> wrote:

> In a Debian 9 host, I receive warnings like:
> Dynamic and static leases present for 172.16.20.201.
> Remove host declaration printer_1 or remove 172.16.20.201
> from the dynamic address pool for 172.16.0.0/16

That was put in a long time ago to deal with a common misconfiguration that keeps popping up and causing problems - especially where people learned on the defective and limited Microsoft server.

> I'm trying to combine static reservations with dynamic assignment in
> same subnet:
> 
> authoritative;
> use-host-decl-names on;
> server-name "equilibri.cpu.actiu.net";
> subnet 172.16.0.0 netmask 255.255.0.0 {
>        option routers 172.16.20.100;
>        option broadcast-address 172.16.255.255;
>        option domain-name-servers 172.16.21.61;
>        option ntp-servers 172.16.20.100;
>        pool {
>                # IP range to be assigned dinamically
>                range 172.16.20.150 172.16.20.189;
>                allow unknown-clients;
>        }
>        pool {
>                # IP range 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;
> #                deny all clients;
>                group MyReservations {
>                        host printer_1 {  # Impressora
>                                hardware ethernet **:**:**:**:**:**;
>                                fixed-address 172.16.20.201;
>                                option host-name "printer_1";
>                        }
>                }
>        }
> }
> 
> But I've not clear if "group" and "host" work inside "pool", or what
> else is the problem.

You need to do exactly what the message says - remove the address from the pool, or remove it from the host declaration. To do the former you need to split your pool like this :

pool {
  range 172.16.20.190 172.16.20.200;
  range 172.16.20.202 172.16.20.255;
}

Also, you should move your host declarations outside of the subnets - they are always global in scope but by putting them inside a subnet you can get some "interesting" inheritance issues that will have you pulling your hair out (think, get address from one subnet, default router from another !)



More information about the dhcp-users mailing list