Convert dynamic Kea DHCPv6 leases into static DHCPv6 reservations

Started by 9axqe, July 15, 2025, 06:40:18 PM

Previous topic - Next topic
ISC had a button that allowed this conversion, this does not seem to exist in Kea, at least not for DHCPv6.

Attempting to create a static reservation fails, because the DUID already exists (as a dynamic lease).

dnsmasq has that button since it supports this kind of conversion transparently.
Hardware:
DEC740

He asked about KEA, not dnsmasq.  I am also curious when this will be added to KEA dhcpv6?

I also find that the DUID column hides most the text field, so I cant manually copy to create my own static entry. What I have had to do is use my external logging to find the DUIDs.


July 16, 2025, 07:04:11 AM #3 Last Edit: July 16, 2025, 07:07:42 AM by Monviech (Cedrik)
In upcoming 25.7 the grids have been reworked to be able to move columns and resize them, which will improve text in them not fully showing.

Im curious what exactly fails when creating a reservation with the same DUID as an existing lease, does KEA crash or something? Or logs it that its ignored?
Hardware:
DEC740

When the DUID appears truncated, you can still copy the entire DUID. Just double click the DUID to the entire cell becomes highlighted/selected and press ctrl-C. It will copy the entire DUID, including the part which is hidden.

I believe this is called a CSS text overflow ellipsis, this is not specific to the opnsense web interface.

Quote from: Monviech (Cedrik) on July 16, 2025, 07:04:11 AMIm curious what exactly fails when creating a reservation with the same DUID as an existing lease, does KEA crash or something? Or logs it that its ignored?

Upon clicking "save", the DUID field becomes circled with red, and a red text appears on the right of the DUID field, stating: "Duplicate entry exists"

This is the feature request for DHCPv4 as far as I can tell, although it does not explicitly say IPv4, it mentions MAC:

https://github.com/opnsense/core/issues/7950

The DUID has a unique per subnet constraint, it does not reference any existing leases data in the current kea leases database to constrain its usage.

https://github.com/opnsense/core/blob/7d0a448157dd7fe115200fe0701669e43d9e6352/src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.xml#L109-L122

In my test this only triggers if you create two entries with the same DUID or the same IP address in the same subnet.
Hardware:
DEC740

Is there a way to delete a lease? I could manually delete it, and add the reservation.

The volume of such occurrences in my case is low, hence that would be manageable for now.

The code just checks for existing reservations in your configuration (config.xml). It does not check the leases database of kea.

Are you sure you don't have an existing reservation already that has the same DUID?
Hardware:
DEC740

Ah, thanks, now I see what the issue is. Interesting.

The reservation is for a Raspberry Pi 4 which is connected both over Wi-Fi and LAN. It is the same DUID on both interfaces, but different IPv6 are assigned for each interface, presumably due to the IAID.

Now the interesting part is that ISC DHCPv6 erroneously assigns the **same** IPv6 on both interfaces, leading to IP conflicts (Raspberry Pi not happy). Kea on the other hand correctly tells apart the two interfaces are provides it two different IPv6.

The problem of Kea is of course for creating reservations in such a scenario, since it only checks for DUID and not IAID.