[Kea-users] Overwrite option-data fields with client-classes in reservations
Darren Ankney
darren.ankney at gmail.com
Tue Mar 4 21:44:41 UTC 2025
Hello,
This is due to precedence which is documented here:
https://kea.readthedocs.io/en/kea-2.6.1/arm/dhcp4-srv.html#standard-dhcpv4-options
where it says: "The current Kea options precedence order is (from most
important to least): host reservation, pool, subnet, shared network,
class, global."
Kea will use the first option content that it finds for a particular
option in that above order. Note that subnet comes before class.
You can use the flex_option to override option content based on class
membership: https://kea.readthedocs.io/en/kea-2.6.1/arm/hooks.html#libdhcp-flex-option-so-flexible-option-actions-for-option-value-settings
Thank you,
Darren Ankney
On Tue, Mar 4, 2025 at 11:08 AM Walter Reiner via Kea-users
<kea-users at lists.isc.org> wrote:
>
> Hi,
>
> I'm trying to overwrite option-data fields, e.g. domain-name-servers but also others, for specific reservations identified by MAC address. As the hosts are not separable by different pools, I thought the best option would be to create client-classes with the option-data I want to override and assign them through reservations to the clients so I don't have to duplicate this information through option-data blocks for every client. For clients without a reservation the idea was to set default option-data values on the subnet level.
>
> I have the following configuration:
>
> ~~~
> {
> "Dhcp4": {
> ...
> "client-classes": [
> {
> "name": "google-ns",
> "option-data": [
> { "name": "domain-name-servers", "data": "8.8.8.8" }
> ]
> }
> ],
> "subnet4": [
> {
> "id": 1,
> "subnet": "192.168.24.0/24",
> "pools": [ { "pool": "192.168.24.6 - 192.168.24.100" } ],
> "option-data": [
> { "name": "routers", "data": "192.168.24.243" },
> { "name": "domain-name-servers", "data": "192.168.24.2" },
> ],
> <?include "/etc/kea/reservations.json"?>
> }
> ],
> ...
> }
> ~~~
>
> Which includes the following reservations:
>
> ~~~
> "reservations": [
> {
> "hw-address": "aa:bb:cc:dd:ee:ff",
> "ip-address": "192.168.24.31",
> "hostname": "dhtc01",
> "client-classes": ["google-ns"]
> },
> ]
> ~~~
>
> In this example, clients however always get the subnets domain-name-servers option instead of the one configured in the assigned client-class. When I explicitly add the option-data to the reservation, the overwrite works.
>
> I'm using isc-kea-dhcp4-server 2.6.1-isc20240725093407 on Debian 12.
>
> Any pointers are greatly appreciated.
>
> Thank you!
>
> --
> 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.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
More information about the Kea-users
mailing list