Transfer boot file base on client's MAC - Printable Version +- iPXE discussion forum (https://forum.ipxe.org) +-- Forum: iPXE user forums (/forumdisplay.php?fid=1) +--- Forum: General (/forumdisplay.php?fid=2) +--- Thread: Transfer boot file base on client's MAC (/showthread.php?tid=7231) |
Transfer boot file base on client's MAC - vielktus - 2014-03-07 08:51 Hi there, I see this script on the homepage: Code: if exists user-class and option user-class = "iPXE" { Can you show me how to make the script "real_boot_script.php" change the filename based on client's MAC ? For example, a client with MAC aa-bb-cc-dd-ee-ff requests the DHCP. I want DHCP to transfer the boot script aa-bb-cc-dd-ee-ff.php to it. If this file is not existed, the default.php will be chose. RE: Transfer boot file base on client's MAC - robinsmidsrod - 2014-03-10 10:58 This is how I do it with an iPXE script instead of having to declare it all in the DHCP server. https://gist.github.com/robinsmidsrod/2234639 Check boot.ipxe which optionally loads an override script for a specific machine (based on hostname, ip, uuid, mac or nic driver) and boot/testvm.ipxe which is a customization based on the hostname assigned to the machine. RE: Transfer boot file base on client's MAC - mcb30 - 2014-03-10 15:01 (2014-03-07 08:51)vielktus Wrote: Can you show me how to make the script "real_boot_script.php" change the filename based on client's MAC ? You can include ${mac} within the DHCP filename, e.g.: Code: filename "http://my.web.server/boot.php?mac=${mac}"; Alternatively, you can use an iPXE script. This gives you the option to fall back to an alternative script if the one you want doesn't exist. For example: Code: #!ipxe (Note the use of the ":hexhyp" settings type to obtain the MAC address with hyphen separators rather than colons, since colons are generally not valid in filenames.) Michael RE: Transfer boot file base on client's MAC - vielktus - 2014-03-23 13:44 The "mac:hexhyp" and "github" saved my day. Thank you so much mcb30 and robin. |