Override dynamic lease with static reservation

Christian Kratzer ck-lists at cksoft.de
Sun Sep 29 08:04:10 UTC 2019


Hi,

On Fri, 27 Sep 2019, Marc Haber wrote:
> On Fri, Sep 27, 2019 at 04:39:31PM +0200, Christian Kratzer wrote:
>> my experience with isc dhcp is that once you have a host reservation
>> that matches the client, the host reservation takes precedence over
>> any historic lease.
>>
>> This should automatically lead to the server sending a NAK to a client
>> requesting the old dynamic lease.
>
> Negative, Sir. Not here.

your system is messed up in some way.  I just verified the behaviour in my setup

- Redundant ISC dhcp setup running on two FreeBSD 12 VM
- isc-dhcp43-server-4.3.6P1_1
- Debian buster client vm


1. Allow debian buster vm to aquire dynamic lease

Sep 29 09:53:13 nocfra2 dhcpd[51637]: DHCPDISCOVER from 52:54:00:e4:f0:e6 via 192.168.37.1
Sep 29 09:53:14 nocfra2 dhcpd[51637]: DHCPOFFER on 192.168.37.212 to 52:54:00:e4:f0:e6 (buster) via 192.168.37.1
Sep 29 09:53:14 nocfra2 dhcpd[51637]: DHCPREQUEST for 192.168.37.212 (192.168.33.22) from 52:54:00:e4:f0:e6 (buster) via 192.168.37.1
Sep 29 09:53:14 nocfra2 dhcpd[51637]: DHCPACK on 192.168.37.212 to 52:54:00:e4:f0:e6 (buster) via 192.168.37.1

2. add host entry into both dhcp configs

host buster {
     hardware ethernet 52:54:00:e4:f0:e6;
     option host-name "buster";
     fixed-address 192.168.37.63;
}

3. forcibly power off debian buster vm off using virsh

4. reboot debian buster vm

Sep 29 09:55:19 nocfra2 dhcpd[51735]: DHCPREQUEST for 192.168.37.212 from 52:54:00:e4:f0:e6 via 192.168.37.1: lease 192.168.37.212 unavailable.
Sep 29 09:55:19 nocfra2 dhcpd[51735]: DHCPNAK on 192.168.37.212 to 52:54:00:e4:f0:e6 via 192.168.37.1
Sep 29 09:55:19 nocfra2 dhcpd[51735]: uid lease 192.168.37.212 for client 52:54:00:e4:f0:e6 is duplicate on 192.168.37.0/24
Sep 29 09:55:19 nocfra2 dhcpd[51735]: DHCPDISCOVER from 52:54:00:e4:f0:e6 via 192.168.37.1
Sep 29 09:55:19 nocfra2 dhcpd[51735]: DHCPOFFER on 192.168.37.63 to 52:54:00:e4:f0:e6 via 192.168.37.1
Sep 29 09:55:19 nocfra2 dhcpd[51735]: uid lease 192.168.37.212 for client 52:54:00:e4:f0:e6 is duplicate on 192.168.37.0/24
Sep 29 09:55:19 nocfra2 dhcpd[51735]: DHCPREQUEST for 192.168.37.63 (192.168.33.21) from 52:54:00:e4:f0:e6 via 192.168.37.1
Sep 29 09:55:19 nocfra2 dhcpd[51735]: DHCPACK on 192.168.37.63 to 52:54:00:e4:f0:e6 via 192.168.37.1

as you see the vm tries to request the old dynamic ip but received a DHCPNAK

It subsequently falls back into DISOCOVER and gets the host entry.


Summary:

This is default isc dhcp behaviour.

>From all that I remember from looking at the code host always takes precence from dynamic leases.

So if this is not happening in your system then you are either

- doing something differently
- have some strange configuration or patches
- your host entry is not matching

So perhaps you would like to share your configuration and what version of isc dhcp with what patches you are running.

Specifically it would be interesting to see how exactly you are doing your host reservation.

Greetings
Christian

>> If it is not sending a nack then I would think that your host
>> reservation is not matching the client request. Subnet mismatch or
>> criteria mismatch.
>
> Then the reservation would not work after manually removing the dynamic
> lease from the database.
>
>> So you can just leave the lease to expire normally.
>
> On my systems, the dynamic lease gets renewed. And renewed. And renewed.
>
> Greetings
> Marc
>
>

-- 
Christian Kratzer                   CK Software GmbH
Email:   ck at cksoft.de               Wildberger Weg 24/2
Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian Kratzer
Web:     http://www.cksoft.de/


More information about the dhcp-users mailing list