expected behavior of 'static' leases/reservations with infinite-is-reserved

Simon dhcp1 at thehobsons.co.uk
Tue Jan 4 21:07:42 UTC 2022


Stephan Seeger <stephanseeger at gmx.net> wrote:

> From what I've read in the docs and various internet sources my
> understanding is that setting the directive globally to 'on' in
> dhcpd.conf I should be able to have host entries with 'infinite'
> leasetimes that serve as 'static' leases/reservations (even) within a
> dynamic range.
> 
> Respective lines in my dhcpd.conf look like this:
> 
> 
> xxxxxxxxxxxxxxxxxx   snip   xxxxxxxxxxxxxxxxxx
> 
> ...
> 
> infinite-is-reserved on;
> 
> ...
> 
> subnet 172.16.1.0 netmask 255.255.255.0 {
>  range 172.16.1.10 172.16.1.199;
>  option subnet-mask 255.255.255.0;
>  option routers 172.16.1.1;
>  option broadcast-address 172.16.1.255;
>  host test {
>   hardware ethernet de:ad:be:ef:de:ad;
>   fixed-address 172.16.1.200;
>   min-lease-time 4294967295;
>   max-lease-time 4294967295;
>  }

First VERY common mistake.
Host statements are global in scope no matter where you put the declaration, BUT if put anywhere but the global scope can have some “interesting” option inheritance issues. Do yourself a favour and put all host declarations in the global scope. Not related to your query, but we have seen issues caused by it.


> From some source I read that these 'static' leases would be processed
> by dhcpd's state engine like normal dynamic leases - but at least in my
> case this doesn't seem to be true. Doing a tail -f on my servers
> /var/lib/dhcp/dhcpd.leases file I was never able to have a lease
> generated for host 'test' in above setting - and also not with following
> modifications of the host definition:
> 
>  host test {
>   hardware ethernet de:ad:be:ef:de:ad;
>   fixed-address 172.16.1.200;
>   min-lease-time -1;
>   max-lease-time -1;
>  }
> 
> ...or...
> 
>  host test {
>   hardware ethernet de:ad:be:ef:de:ad;
>   fixed-address 172.16.1.200;
>   min-lease-time 2147483647;
>   max-lease-time 2147483647;
>  }
> 
> Seems like the 'fixed-address' directive in the host definition prevents
> the server from generating an entry in the leases-file.

Correct, a host statement with a fixed address is treated very differently to a dynamic address. The normal lease lifecycle is not followed and no lease entry will ever be created.

> PS: I did not verify until now but would suspect that also ddns for my
> host 'test' is not possible when there's no lease generated, correct?

Dynamic DNS will work, but you have to set an option - something like update-static-leases (check the docs). If you set this, then DNS will be updated on every lease renewal, and the entries will never be removed (because there’s no lease to expire).


To answer your query, I think what you need to do is to config for a client to be offered a “dynamic” lease with an “infinite” lifetime. It may be as simple as just removing the fixed-address statement from your config. If I sound a bit vague, it’s because this is a feature I’ve never used.


Simon




More information about the dhcp-users mailing list