Re: [Kea-users] dynamic hostname Option 12 in a kea pool
Hi Joop,
> Would it be possible to limit the libdhcp_flex_option.so hook to a specific
> pool
or interface.
You can add the client(s) you want to modify to a class in some way
(see: https://kea.readthedocs.io/en/stable/arm/classify.html) and the
supersede can be limited to a certain class as described here:
https://kea.readthedocs.io/en/stable/arm/hooks.html#libdhcp-flex-option-so-flexible-option-actions-for-option-value-settings
where it says:
> Since Kea 2.1.4, the client-class parameter specifies a class guard, and
> takes a client-class name. If not empty, the client's packet needs to belong
> to tne specified class for this entry to be used.
Thank you,
Darren Ankney
On Thu, Dec 18, 2025 at 10:13 AM Joop Boonen wrote:
>
> On Wednesday, December 17, 2025 12:04:01 PM Central European Standard Time
> Carsten Strotmann via Kea-users wrote:
> > Hi Joop,
> >
> > On 17 Dec 2025, at 11:29, Joop Boonen wrote:
> > > Dear all,
> > >
> > > I didn't find any option to implement dynamic host-names in kea pool.
> > >
> > > Like this in isc dhcpd.
> > >
> > > subnet 172.26.250.0 netmask 255.255.254.0 {
> > >
> > > set machex = binary-to-ascii(16, 8, "", substring(hardware, 1, 6));
> > > set macsuffix = suffix(machex, 6);
> > > set hstnm = concat("vm-", macsuffix);
> > > option host-name = hstnm; # Option 12
> > >
> > > -->8--
> > >
> > > i.e.
> > >
> > > pool {
> > >
> > > range 172.26.250.64 172.26.251.250;
> > >
> > >set machex = binary-to-ascii(16, 8, "", substring(hardware, 1, 6));
> > >set macsuffix = suffix(machex, 6);
> > >set hstnm = concat("vm-", macsuffix);
> > >option host-name = hstnm; # Option 12
> > >
> > > -->8--
> > >
> > > Does anyone know if this is possible, in kea?
> >
> > Yes, it is possible, even via multiple ways:
> >
> > 1)
> > via DDNS-Tuning, see the examples at
> > https://kea.readthedocs.io/en/stable/arm/hooks.html#libdhcp-ddns-tuning-so-d
> > dns-tuning
> >
> > 2)
> > via flexible-options (the expression below is build based on your ISC-DHCP
> > code, I've not tested it):
> >
> > {
> > "library": "libdhcp_flex_option.so",
> > "parameters": {
> > "options": [
> > {
> >"name": "host-name",
> >"supersede":
> > "concat("vm-",substring(hexstring(option[host-name].hex,""),-1,6))",
> > "csv-format": true
> > },
> > ]
> > }
> > },
> >
> > Greetings
> >
> > Carsten
>
> Thank you very much for your answer.
>
> I've just tested this solution. Option 12 works like a charm.
>
> Sadly the ddns entries aren't written i.e. they don't end up in the bind9
> zones.
>
> My configuration:
> "Dhcp4": {
> "hooks-libraries": [
> { "library": "libdhcp_flex_option.so",
> "parameters": {
> "options": [
> {
> "name": "host-name",
> "supersede":
> "concat('vm-',hexstring(option[50].hex,''))",
> "csv-format": true
> }
> ]
> }
> }
> ],
>
>
>"hw-address": "",
>"ip-address": "",
>"hostname": ""
>
> are written correctly in bind9.
>
> Would it be possible to limit the libdhcp_flex_option.so hook to a specific
> pool
> or interface.
>
>
> 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]
--
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] dynamic hostname Option 12 in a kea pool
On Wednesday, December 17, 2025 12:04:01 PM Central European Standard Time
Carsten Strotmann via Kea-users wrote:
> Hi Joop,
>
> On 17 Dec 2025, at 11:29, Joop Boonen wrote:
> > Dear all,
> >
> > I didn't find any option to implement dynamic host-names in kea pool.
> >
> > Like this in isc dhcpd.
> >
> > subnet 172.26.250.0 netmask 255.255.254.0 {
> >
> > set machex = binary-to-ascii(16, 8, "", substring(hardware, 1, 6));
> > set macsuffix = suffix(machex, 6);
> > set hstnm = concat("vm-", macsuffix);
> > option host-name = hstnm; # Option 12
> >
> > -->8--
> >
> > i.e.
> >
> > pool {
> >
> > range 172.26.250.64 172.26.251.250;
> >
> >set machex = binary-to-ascii(16, 8, "", substring(hardware, 1, 6));
> >set macsuffix = suffix(machex, 6);
> >set hstnm = concat("vm-", macsuffix);
> >option host-name = hstnm; # Option 12
> >
> > -->8--
> >
> > Does anyone know if this is possible, in kea?
>
> Yes, it is possible, even via multiple ways:
>
> 1)
> via DDNS-Tuning, see the examples at
> https://kea.readthedocs.io/en/stable/arm/hooks.html#libdhcp-ddns-tuning-so-d
> dns-tuning
>
> 2)
> via flexible-options (the expression below is build based on your ISC-DHCP
> code, I've not tested it):
>
> {
> "library": "libdhcp_flex_option.so",
> "parameters": {
> "options": [
> {
>"name": "host-name",
>"supersede":
> "concat("vm-",substring(hexstring(option[host-name].hex,""),-1,6))",
> "csv-format": true
> },
> ]
> }
> },
>
> Greetings
>
> Carsten
Thank you very much for your answer.
I've just tested this solution. Option 12 works like a charm.
Sadly the ddns entries aren't written i.e. they don't end up in the bind9
zones.
My configuration:
"Dhcp4": {
"hooks-libraries": [
{ "library": "libdhcp_flex_option.so",
"parameters": {
"options": [
{
"name": "host-name",
"supersede":
"concat('vm-',hexstring(option[50].hex,''))",
"csv-format": true
}
]
}
}
],
"hw-address": "",
"ip-address": "",
"hostname": ""
are written correctly in bind9.
Would it be possible to limit the libdhcp_flex_option.so hook to a specific
pool
or interface.
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]
Re: [Kea-users] dynamic hostname Option 12 in a kea pool
Hi Joop,
On 17 Dec 2025, at 11:29, Joop Boonen wrote:
> Dear all,
>
> I didn't find any option to implement dynamic host-names in kea pool.
>
> Like this in isc dhcpd.
>
> subnet 172.26.250.0 netmask 255.255.254.0 {
> set machex = binary-to-ascii(16, 8, "", substring(hardware, 1, 6));
> set macsuffix = suffix(machex, 6);
> set hstnm = concat("vm-", macsuffix);
> option host-name = hstnm; # Option 12
> -->8--
>
> i.e.
>
> pool {
> range 172.26.250.64 172.26.251.250;
>set machex = binary-to-ascii(16, 8, "", substring(hardware, 1, 6));
>set macsuffix = suffix(machex, 6);
>set hstnm = concat("vm-", macsuffix);
>option host-name = hstnm; # Option 12
> -->8--
>
> Does anyone know if this is possible, in kea?
>
Yes, it is possible, even via multiple ways:
1)
via DDNS-Tuning, see the examples at
https://kea.readthedocs.io/en/stable/arm/hooks.html#libdhcp-ddns-tuning-so-ddns-tuning
2)
via flexible-options (the expression below is build based on your ISC-DHCP
code, I've not tested it):
{
"library": "libdhcp_flex_option.so",
"parameters": {
"options": [
{
"name": "host-name",
"supersede":
"concat("vm-",substring(hexstring(option[host-name].hex,""),-1,6))",
"csv-format": true
},
]
}
},
Greetings
Carsten
--
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]
