[Kea-users] Passing hostname option to iPXE boot-file-name URL

patrick ddiguru.com patrick at ddiguru.com
Tue Sep 13 18:35:06 UTC 2022


Hi,

I'm attempting to create a mechanism that sets option 67 boot-file-name to a URL w/ the client's hostname as a URL param. I found that I needed to use the flex_option hook to do this. The following code works partially:

"hooks-libraries": [
    {
        "library": "/usr/lib64/kea/hooks/libdhcp_flex_option.so",
        "parameters": {
            "options": [
                {
                    "code": 67,
                    "name": "boot-file-name",
                    "add": "ifelse( ( (substring(option[77].hex,0,4) == 'iPXE') and (option[host-name].exists) ), concat('http://x.x.x.x/ipxe.php?host=',option[host-name].text <http://x.x.x.x/ipxe.php?host=%27,option[host-name].text>), '')"
                }
            ]
        }
    }
],

If the DHCP client matches option 77 user-class with the string "iPXE" && the DHCP client sends option 12 host-name, the URL is set w/ that client's hostname. I need the same code to work with fixed address host entries. So, if I have a host record created that reserves that client's IP address and Hostname via the Mac address, I need that declared hostname to be passed in the URL. I can't seen to find a way to do that. Again, if the client sends a value for option 12, it works (fixed host record or not), but if it doesn't send option 12 it does not. 

When I use the host record - the server already knows the value for option 12 and returns it back to the client, and was thinking this SHOULD work. Anyone have any ideas? 

Thanks

DDI Guru
Patrick Piper
http://ddiguru.com <http://ddiguru.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20220913/0ebbeacf/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2475 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20220913/0ebbeacf/attachment.bin>


More information about the Kea-users mailing list