Hi Peter,

I'm not sure, but it looks like what I want doesn't work.

I have the following kea-dhcp4.conf configuration (snippets):


"Dhcp4": {
    "hooks-libraries": [
        {
            "library": "libdhcp_ddns_tuning.so",
            "parameters": {
                "hostname-expr" : "'vm-test-' + 
split(addrtotext(option[50].hex),'.',1) + '-' + 
split(addrtotext(option[50].hex),'.',2) + '-' + 
split(addrtotext(option[50].hex),'.',3) + '-' + 
split(addrtotext(option[50].hex),'.',4)"
            }
        },
        {
            "library": "libdhcp_flex_id.so",
            "parameters": {
                "identifier-expression": "substring(hexstring(pkt4.mac,''),
0,6)",
                "replace-flex-id": true
            }
        },
        {   "library": "libdhcp_flex_option.so",
            "parameters": {
                "options": [
                    {
                        "name": "host-name",
                        "supersede": "'vm-test-' + 
split(addrtotext(option[50].hex),'.',1) + '-' + 
split(addrtotext(option[50].hex),'.',2) + '-' + 
split(addrtotext(option[50].hex),'.',3) + '-' + 
split(addrtotext(option[50].hex),'.',4)",
                        "csv-format": true
                    }
                ]
            }
        }
    ],

When I have entry:

    "subnet4": [
        {
            // This defines the whole subnet. Kea will use this information to
            // determine where the clients are connected. This is the whole
            // subnet in your network.

            // Subnet identifier should be unique for each subnet.
            "id": 1,

            // This is mandatory parameter for each subnet.
            "subnet": "10.10.10.0/24",

            // Pools define the actual part of your subnet that is governed
            // by Kea. Technically this is optional parameter, but it's
            // almost always needed for DHCP to do its job. If you omit it,
            // clients won't be able to get addresses, unless there are
            // host reservations defined for them.
            "pools": [ { "pool": "10.10.10.32 - 10.10.10.192" } ],

            "reservations": [

                // This is a reservation for a specific hardware/MAC address.
                // It's a rather simple reservation: just an address and 
nothing
                // else.
                {
                    "hw-address": "52:54:00:97:8b:89",
                    "hostname": "dummy-name"
                },

It's fine a dns name is sent via Option (12) and the dnsname is written in dns. 
IP sent 10.10.10.32

With entry:

                {
                    "flex-id": "'525400'",
                    "hostname": "dummyvalue"
                },

No dns entry is written, the hostname has only be sent via Option(12). 
IP sent 10.10.10.32

I also looks like this flex-id hasn't been used. I don't know how to debug 
this. 
My  "severity": "DEBUG"  and "debuglevel": 99

It would be great to have an option like:

            "pools": [ { "pool": "10.10.10.32 - 10.10.10.192" },
            "hostname": "ddns: }
             ],

So a hostname can be given dynamically to all hosts in a pool.




On Tuesday, January 6, 2026 2:42:46 PM Central European Standard Time you 
wrote:
> Hi Joop,
>     A host reservations require an identifier; otherwise, Kea would have
> no way
> of knowing which client the reservation is intended for.
> 
> The reservation identifier need not be the “hw-address. The "duid",
> "circuit-id",
> and "client-id" may also be used.
> 
> The flex-id hooks library enables user-defined identifiers based on the
> contents
> of DHCP request packets.
> See:
> https://kea.readthedocs.io/en/stable/arm/hooks.html#libdhcp-flex-id-so-flexi
> ble-identifier-for-host-reservations
> 
> If you know in advance that all clients on a subnet need to have their
> hostname
> processed in this way, it is  possible to limit the scope of the
> "hostname-expr"
> to a subnet by adding a “ddns-tuning” “user-context” to the subnet
> definition.
> For example:
>   "subnet4": [{
>       "subnet": "192.0.2.0/24",
>       "pools": [{ "pool": "192.0.2.10 - 192.0.2.20" } ],
>       "user-context": {
>           "ddns-tuning":
>               "hostname-expr" :
> "concat('vm-test-',addrtotext(option[50].hex))" }
>           }
>       }
>   }],
> 
> 
> 
> Perhaps your intended use of host reservations performs a different
> function than
> that normally associated with host reservations. Maybe some sort of 
> limiting
> mechanism?
> 
> On 06/01/2026 10.48, Joop Boonen wrote:
> > Hi,
> > 
> > Thank you for the answer. The addrtotext option is great.
> > 
> > I would like to explain what we need.
> > 
> > We wouldn't like to use an identifier for every host.
> > 1) Because we want to hand out DNS names to VMs with random MAC addresses.
> > 2) We are using /24 and /23 networks. So that even if we would know the
> > MAC- addresses this would mean a lot of entries in the kea-dhcp*.conf.
> > 
> > It would be great dns names could be handed out for a pool in
> > kea-dhcp*.conf for a host that doesn't have an identifier. Or an Asterix
> > identifier.
> > 
> > Regards,
> > 
> > Joop.
> > 
> > On Tuesday, January 6, 2026 9:35:04 AM Central European Standard Time
> > Peter
> > 
> > Davies wrote:
> >> Hi Joop,
> >> 
> >>       A host reservation should have an identifier. If you do not use the
> >> 
> >> "hw-address,"
> >> what identifier do you use?
> >> 
> >> You may wish to use the following, which appends the IP address to the
> >> 
> >> hostname:
> >>                   "hostname-expr" :
> >> "concat('vm-test-',addrtotext(option[50].hex))" } }
> >> 
> >> /Peter
> >> 
> >> On 05/01/2026 16.59, Joop Boonen wrote:
> >>> Dear all,
> >>> 
> >>> I'm using the option like this.
> >>> "Dhcp4": {
> >>> 
> >>>       "hooks-libraries": [
> >>>       
> >>>           {
> >>>           
> >>>               "library": "libdhcp_ddns_tuning.so",
> >>>               "parameters": {
> >>>               
> >>>                   "hostname-expr" : "concat('vm-
> >>> 
> >>> test-',hexstring(option[50].hex,''))"
> >>> 
> >>>               }
> >>>           
> >>>           },
> >>> 
> >>> I notice when I don't have an hw-address entry
> >>> 
> >>>                   {
> >>>                   
> >>>                       "hw-address": "<hw-addres>",
> >>>                       "ip-address": "<ip-address",
> >>>                       "hostname": "<hostname>"
> >>>                   
> >>>                   },
> >>> 
> >>> The ddns entries doesn't get Updated.
> >>> For some reason it looks like hostname-expr needs an assigned hostname.
> >>> 
> >>> Does someone know how this can be solved.
> >>> 
> >>> Regards,
> >>> 
> >>> Joop Boonen.
-- 
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]

Reply via email to