opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.22k stars 718 forks source link

KEA DHCP Reservation bypassed #7435

Open bdonfouet opened 4 months ago

bdonfouet commented 4 months ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

I ' running opnsense 24.1.6 and have reservations on Kea DHCP. i have a synology nas which interface is configured to dhcp mode, and a reservation on Kea with the mac address. After reboots, the NAS still get the old IP it was getting before i setup the reservation and never get the reserved ip!

To Reproduce

Steps to reproduce the behavior:

  1. configure a device on your lan to use dhcp, and get an ip
  2. Configure a reservation in Kea using an ip different from the one received in previous step
  3. Restart your device so that he request ip to dhcp server
  4. check your IP, and it is still the old IP

Expected behavior

When restarted my lan device after created the dhcp reservation, the device should received the ip set in reservation

Describe alternatives you considered

Screenshots

none

Relevant log files

In Kea logs, i can see that the device request his old adress(normal dhcp behaviour), and the dhcp server leased it despite the reservation

2024-05-02T19:59:49 Informational   kea-dhcp4   INFO [kea-dhcp4.leases.0x8323d0400] DHCP4_LEASE_ALLOC [hwtype=1 xx:xx:xx:xx:xx:xx], cid=[01:xx:xx:xx:xx:xx:xx], tid=0x2fd91b67: lease 192.168.xx.100 has been allocated for 4000 seconds    
2024-05-02T19:59:49 Informational   kea-dhcp4   INFO [kea-dhcp4.leases.0x8323d0400] DHCP4_INIT_REBOOT [hwtype=1 xx:xx:xx:xx:xx:xx], cid=[01:xx:xx:xx:xx:xx:xx], tid=0x2fd91b67: client is in INIT-REBOOT state and requests address 192.168.xx.100

Additional context

i was using ISC DHCP before, and it was working as expected

Environment OPNsense 24.1.6 (amd64). AMD GX-424CC SOC with Radeon(TM) R5E Graphics (4 cores, 4 threads)

tom-citizencard commented 3 months ago

I think after adding a reservation Kea DHCP service needs a restart and then a reservation works fine in our tests. This is not clear in the UI though so maybe a possible improvement would be to restart Kea service when "Apply" button is pressed?

Hicsy commented 4 days ago

maybe worth noting that KEA largely ignores MAC address and bypasses reservations if it already has a pool-IP cached to requestor's machine-id . I dont know enough about DHCP inner-workings to understand why sorry. (perhaps as part of the general networking stack rather than KEA itself)

On Debian machines dbus-uuidgen etc (ie resetting machine-id) can help alleviate the KEA DHCP cache pains, but I dont know how to ease issue that with SynologyOS, sorry (hopefully just resetting the Kea Service is enough to fix for Syno's)