[ipxe-devel] Booting from local disk on HP ProLiant machines

Robin Smidsrød robin at smidsrod.no
Wed Jan 9 09:56:03 UTC 2013


On 08.01.2013 19:46, Christoph Schug wrote:
> FWIW, I was working on a backup plan today by moving the logic whether
> to boot from local disk or from network to the layer of TFTP, more
> specific tftpd-hpa. I am just noting it here in case someone still has
> the requirement to boot from LVM-managed disks.
> 
> Of course it would be also possible to do this directly in the
> dhcpd.conf, but I am not fancy the restart the mission critical DHCP
> service for ever change, nor do I want to DHCP to be dependent on LDAP
> (supported by vanilla ISC DHCPD) or some SQL database (there is some
> patch floating around which allows control over the host declarations,
> http://blog.alex.org.uk/2010/09/05/adding-sql-support-to-isc-dhcpd/).
> 
> The idea would have been to add the MAC address also to the TFTP request
> as unique identifier ...
> 
> | set client-dashed-mac = concat (
> |     suffix (concat ("0", binary-to-ascii (16, 8, "",
> substring(hardware, 1, 1))),2), "-",
> |     suffix (concat ("0", binary-to-ascii (16, 8, "",
> substring(hardware, 2, 1))),2), "-",
> |     suffix (concat ("0", binary-to-ascii (16, 8, "",
> substring(hardware, 3, 1))),2), "-",
> |     suffix (concat ("0", binary-to-ascii (16, 8, "",
> substring(hardware, 4, 1))),2), "-",
> |     suffix (concat ("0", binary-to-ascii (16, 8, "",
> substring(hardware, 5, 1))),2), "-",
> |     suffix (concat ("0", binary-to-ascii (16, 8, "",
> substring(hardware, 6, 1))),2)
> | );
> |
> | if exists user-class and option user-class = "iPXE" {
> |     set bootstrap-url =
> concat("http://${next-server}/ipxe/bootstrap/", client-dashed-mac);
> | } else {
> |     set bootstrap-url = concat("boot/", client-dashed-mac);
> | }
> | filename = bootstrap-url;
> 
> .. but instead of providing a tftproot/boot/<client-dash-mac> file to
> have some mapfile (tftpd-hpa option "-m") which contains the MAC
> addresses of all machines which should do something with iPXE in order
> to rewrite those requests ("re" rules) to undionly.kpxe. Machines which
> shall boot from local disk are not to be listed here, their requests
> will get an access denied which is here the default policy ("a" rule).
> This aborts the PXE boot and those machines fall back to local boot.
> 
> | re ^boot/00-1f-29-54-2f-e2$ /ipxe/undionly.kpxe
> | re ^boot/00-1f-29-5c-d5-74$ /ipxe/undionly.kpxe
> | a  ^

My bootstrap.ipxe script from https://gist.github.com/2234639 takes care
of allowing a machine-specific script to override the default network
boot option. My example has by default the menu set to "exit", so it
boots local disk by default, but if I create a specially named file in
the bootstrap folder I can override how a specific machine will boot
without having to do any change to the DHCP or TFTP/HTTP server.

If you want something more fancy you can even have some dynamic setup
that creates those files based on certain events happening. It works
equally well with either TFTP or HTTP (I even tried it with the GSoC NFS
support branch, and it works to some extent).

I like the fact that it doesn't require any HTTP CGI scripting to get
dynamic behavior.

-- Robin



More information about the ipxe-devel mailing list