<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Darren,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for the information. The option class-tagging looks like a great feature, unfortunately I need to use the stable release for now. I'm trying to recreate what you explained in your first paragraph and I'm having trouble finding a way to make it work.
I have generic client classes setup for legacy and efi:</div>
<blockquote style="margin-left: 0.8ex; padding-left: 1ex; border-left: 3px solid rgb(200, 200, 200);">
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"client-classes": [</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
{</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"name": "ipxe_legacy",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"test": "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"boot-file-name": "youshallnotpass"</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
},</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
{</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"name": "ipxe_efi",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"test": "substring(option[60].hex,0,20) == 'PXEClient:Arch:00007'",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"boot-file-name": "youshallnotpass"</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
},</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
],</div>
</blockquote>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Then I'm using the flex option hook to dynamically set the boot-file-name option. This is the part where I'm struggling. I want to restrict this to a specific subnet so I created a custom option but I later realized this hook only works for the query packet
and not the outgoing packet.</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<blockquote style="margin-left: 0.8ex; padding-left: 1ex; border-left: 3px solid rgb(200, 200, 200);">
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
{</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_flex_option.so",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"parameters": {</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"options": [</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
{</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"name": "boot-file-name",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"add": "ifelse((option[244].text == '1') and (member('ipxe_legacy')),'ipxe/netboot.xyz.kpxe','')"</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
},</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
{</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"name": "boot-file-name",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"add": "ifelse((option[244].text == '1') and (member('ipxe_efi')),'ipxe/netboot.xyz.efi','')"</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
}</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
]</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
}</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
}</div>
</blockquote>
<div style="line-height: 19px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Subnet:</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<blockquote style="margin-left: 0.8ex; padding-left: 1ex; border-left: 3px solid rgb(200, 200, 200);">
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"subnet4": [</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
{</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"id": 1,</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"subnet": "10.10.10.0/24",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"calculate-tee-times": true,</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"valid-lifetime": 60,</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"ddns-qualifying-suffix": "kea-dev.com",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"option-data": [</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
{</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"name": "subnet-id",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"code": 244,</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"data": "1",</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
"always-send": true</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
}</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
],</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
}</div>
<div style="line-height: 19px; white-space: pre; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
]</div>
</blockquote>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Do you have any ideas to be able to dynamically set the boot-file-name to a different value per-subnet?</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Isaac</div>
<div id="Signature"></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Kea-users <kea-users-bounces@lists.isc.org> on behalf of Darren Ankney <darren.ankney@gmail.com><br>
<b>Sent:</b> Thursday, December 5, 2024 2:35 PM<br>
<b>To:</b> Kea user's list <kea-users@lists.isc.org><br>
<b>Subject:</b> [External] - Re: [Kea-users] Client Class for a Specific Subnet</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Isaac,<br>
<br>
Your choices are limited at the moment. You can use the flex option<br>
hook to replace option content based on class membership as described<br>
in the hook documentation:<br>
<a href="https://kea.readthedocs.io/en/kea-2.6.1/arm/hooks.html#libdhcp-flex-option-so-flexible-option-actions-for-option-value-settings">https://kea.readthedocs.io/en/kea-2.6.1/arm/hooks.html#libdhcp-flex-option-so-flexible-option-actions-for-option-value-settings</a><br>
There is also this KB article that shows this in action:<br>
<a href="https://kb.isc.org/docs/redefining-standard-options">https://kb.isc.org/docs/redefining-standard-options</a> though the subject<br>
of the article is actually about sending different content in an<br>
option than it is supposed to carry.<br>
<br>
In this case, you could set the "else" portion of your ISC DHCP<br>
configuration as an option in the corresponding subnet in the Kea<br>
configuration. Make the client a member of the class as you've shown.<br>
Then use the flex option hook to replace the option content if the<br>
client is a member of "ipxe_legacy_netbootxyz".<br>
<br>
In the development version 2.7.4, there is the new method called<br>
"Option Class-Tagging":<br>
<a href="https://kea.readthedocs.io/en/kea-2.7.4/arm/classify.html#option-class-tagging">https://kea.readthedocs.io/en/kea-2.7.4/arm/classify.html#option-class-tagging</a><br>
that will allow you to tag any option to be sent based on class<br>
membership. This is an effective replacement for the "if"<br>
functionality in ISC DHCP. This will first appear in a stable version<br>
in 3.0.0.<br>
<br>
Thank you,<br>
Darren Ankney<br>
<br>
On Wed, Dec 4, 2024 at 3:48 PM Isaac Brummel <ibrummel@xes-inc.com> wrote:<br>
><br>
> Hello,<br>
> I'm in the process of migrating an ISC DHCP server to Kea. I'm trying to re-create a feature that we use in the ISC DHCP config to set a boot file name if a specific vendor-class-identifier is met. The ISC DHCP share-network looks like:<br>
><br>
> shared-network FOOBAR {<br>
> allow bootp;<br>
><br>
> subnet 10.10.10.0 netmask 255.255.255.0 {<br>
><br>
> # default PXE boot<br>
> if substring(option vendor-class-identifier, 0, 20) = "PXEClient:Arch:00000" {<br>
> filename "ipxe/netboot.xyz.kpxe";<br>
> } else {<br>
> filename "ipxe/netboot.xyz.efi";<br>
> }<br>
><br>
><br>
> For Kea I can create the client class just fine, but how can I restrict these client classes to apply only to this subnet? I have other subnets that use a different boot file name. It doesn't seem like using "client-class" in the "subnet4" config would work
as that would require a client to meet the classification, when that's not necessary.<br>
><br>
> "client-classes": [<br>
> {<br>
> "name": "ipxe_legacy_netbootxyz",<br>
> "test": "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'",<br>
> "next-server": "10.10.10.5",<br>
> "boot-file-name": "ipxe/netboot.xyz.kpxe"<br>
> },<br>
> {<br>
> "name": "ipxe_efi_netbootxyz",<br>
> "test": "substring(option[60].hex,0,20) == 'PXEClient:Arch:00007'",<br>
> "next-server": "10.10.10.5",<br>
> "boot-file-name": "ipxe/netboot.xyz.efi"<br>
> }<br>
> ],<br>
><br>
><br>
> Thanks,<br>
><br>
> Isaac Brummel<br>
> System Administrator<br>
> Extreme Engineering Solutions<br>
> --<br>
> ISC funds the development of this software with paid support subscriptions. Contact us at
<a href="https://www.isc.org/contact/">https://www.isc.org/contact/</a> for more information.<br>
><br>
> To unsubscribe visit <a href="https://lists.isc.org/mailman/listinfo/kea-users">
https://lists.isc.org/mailman/listinfo/kea-users</a>.<br>
><br>
> Kea-users mailing list<br>
> Kea-users@lists.isc.org<br>
> <a href="https://lists.isc.org/mailman/listinfo/kea-users">https://lists.isc.org/mailman/listinfo/kea-users</a><br>
--<br>
ISC funds the development of this software with paid support subscriptions. Contact us at
<a href="https://www.isc.org/contact/">https://www.isc.org/contact/</a> for more information.<br>
<br>
To unsubscribe visit <a href="https://lists.isc.org/mailman/listinfo/kea-users">https://lists.isc.org/mailman/listinfo/kea-users</a>.<br>
<br>
Kea-users mailing list<br>
Kea-users@lists.isc.org<br>
<a href="https://lists.isc.org/mailman/listinfo/kea-users">https://lists.isc.org/mailman/listinfo/kea-users</a><br>
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.<br>
<br>
</div>
</span></font></div>
</body>
</html>