[Kea-users] Changing subnet ID

2025-10-18 Thread Per von Zweigbergk via Kea-users
Hello!

I am running kea in a 2-node HA cluster (hot-standby mode), with manually 
written JSON configuration and memfile lease backend.

We'd like to migrate to using 
netbox-kea-dhcp to generate 
DHCP configuration. As far as I can tell from reading the source code, the tool 
works by generating configuration based on subnet ID being equal to the prefix 
ID in Netbox. (A prefix in Netbox is an object representing an IP subnet, and 
has its own ID.)

This won't work for us out of the box, because if we just blindly start 
creating subnet objects with prefix IDs that collide with our previous manually 
configured subnet IDs, the lease database will get confused. Therefore, as an 
intermediate step before implementing this sync, I would like to change the 
subnet IDs in my configuration, so the subnet IDs match up with the prefix IDs 
in Netbox.

However, if I just change this in the config, we'll get this lease database 
confusion. Therefore, my idea is to:


  *   In an outage window, stop both kea servers in the cluster to make sure 
the lease database isn't being touched
  *   Change the JSON configuration to update the subnet IDs to the new desired 
subnet IDs, keeping note of the old ones
  *   Run some type of tool to change the subnet ID column of each rows to 
change from the old to new subnet ID (should be easy, it's just a CSV file)
  *   Restart kea

Before I go ahead and do this, I'd like some feedback from the community. Is 
there anything wrong with my approach? And is there an easier way of doing the 
same thing?

(One thing to consider might be to de-couple kea subnet IDs from the netbox 
prefix IDs, and instead use user-context to store the netbox ID and do the 
mapping that way, but that would likely be more work than just doing the 
one-time operation above.)
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
[email protected]


Re: [Kea-users] Changing subnet ID

2025-10-18 Thread Darren Ankney
Hi,

Kea should be able to do just this using sanity checks:
https://kea.readthedocs.io/en/kea-3.0.1/arm/dhcp4-srv.html#sanity-checks-in-dhcpv4
but the default is "warn" so you would need to set:

 "sanity-checks": {
"lease-checks": "fix"
},

It is recommended that you make a copy of all of this data in a test
lab and try there first.

Thank you,
Darren Ankney

On Tue, Oct 14, 2025 at 7:15 AM Per von Zweigbergk via Kea-users
 wrote:
>
> Hello!
>
>
>
> I am running kea in a 2-node HA cluster (hot-standby mode), with manually 
> written JSON configuration and memfile lease backend.
>
>
>
> We’d like to migrate to using netbox-kea-dhcp to generate DHCP configuration. 
> As far as I can tell from reading the source code, the tool works by 
> generating configuration based on subnet ID being equal to the prefix ID in 
> Netbox. (A prefix in Netbox is an object representing an IP subnet, and has 
> its own ID.)
>
>
>
> This won’t work for us out of the box, because if we just blindly start 
> creating subnet objects with prefix IDs that collide with our previous 
> manually configured subnet IDs, the lease database will get confused. 
> Therefore, as an intermediate step before implementing this sync, I would 
> like to change the subnet IDs in my configuration, so the subnet IDs match up 
> with the prefix IDs in Netbox.
>
>
>
> However, if I just change this in the config, we’ll get this lease database 
> confusion. Therefore, my idea is to:
>
>
>
> In an outage window, stop both kea servers in the cluster to make sure the 
> lease database isn’t being touched
> Change the JSON configuration to update the subnet IDs to the new desired 
> subnet IDs, keeping note of the old ones
> Run some type of tool to change the subnet ID column of each rows to change 
> from the old to new subnet ID (should be easy, it’s just a CSV file)
> Restart kea
>
>
>
> Before I go ahead and do this, I’d like some feedback from the community. Is 
> there anything wrong with my approach? And is there an easier way of doing 
> the same thing?
>
>
>
> (One thing to consider might be to de-couple kea subnet IDs from the netbox 
> prefix IDs, and instead use user-context to store the netbox ID and do the 
> mapping that way, but that would likely be more work than just doing the 
> one-time operation above.)
>
> --
> ISC funds the development of this software with paid support subscriptions. 
> Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
> [email protected]
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
[email protected]


Re: [Kea-users] Changing subnet ID

2025-10-17 Thread Elton, Norman N
We’ve done this with CSV lease files. Stopped both servers, modified our 
configuration files, ran a script to update the subnet IDs in the lease files, 
and restarted the servers. Worked fine!

Norman

From: Kea-users  on behalf of Per von 
Zweigbergk via Kea-users 
Date: Tuesday, October 14, 2025 at 7:15 AM
To: [email protected] 
Cc: Per von Zweigbergk 
Subject: [Kea-users] Changing subnet ID
Hello!

I am running kea in a 2-node HA cluster (hot-standby mode), with manually 
written JSON configuration and memfile lease backend.

We’d like to migrate to using 
netbox-kea-dhcp<https://github.com/francoismdj/netbox-kea-dhcp> to generate 
DHCP configuration. As far as I can tell from reading the source code, the tool 
works by generating configuration based on subnet ID being equal to the prefix 
ID in Netbox. (A prefix in Netbox is an object representing an IP subnet, and 
has its own ID.)

This won’t work for us out of the box, because if we just blindly start 
creating subnet objects with prefix IDs that collide with our previous manually 
configured subnet IDs, the lease database will get confused. Therefore, as an 
intermediate step before implementing this sync, I would like to change the 
subnet IDs in my configuration, so the subnet IDs match up with the prefix IDs 
in Netbox.

However, if I just change this in the config, we’ll get this lease database 
confusion. Therefore, my idea is to:


  *   In an outage window, stop both kea servers in the cluster to make sure 
the lease database isn’t being touched
  *   Change the JSON configuration to update the subnet IDs to the new desired 
subnet IDs, keeping note of the old ones
  *   Run some type of tool to change the subnet ID column of each rows to 
change from the old to new subnet ID (should be easy, it’s just a CSV file)
  *   Restart kea

Before I go ahead and do this, I’d like some feedback from the community. Is 
there anything wrong with my approach? And is there an easier way of doing the 
same thing?

(One thing to consider might be to de-couple kea subnet IDs from the netbox 
prefix IDs, and instead use user-context to store the netbox ID and do the 
mapping that way, but that would likely be more work than just doing the 
one-time operation above.)
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
[email protected]