Friday, December 02, 2011

PXELinux: Load menu other than default

When loading PXELinux via DHCP as specified in dhcp.conf:

filename "pxelinux.0";

Once PXELinux was loaded, it will look for configuration in the following order:

  1. Client PC’s GUID
  2. Client PC’s MAC Address
  3. Client PC”s IP address
  4. pxelinux.cfg/default

These searching order may reveal from /var/log/messages:

Nov 28 08:58:09 dolphin in.tftpd[24603]: RRQ from 192.168.0.181 filename gpxelinux.0
Nov 28 08:58:09 dolphin in.tftpd[24604]: RRQ from 192.168.0.181 filename pxelinux.cfg/0338a9f6-d2b1-11df-9ec1
-0013d4d9c9e8
Nov 28 08:58:09 dolphin in.tftpd[24605]: RRQ from 192.168.0.181 filename pxelinux.cfg/01-70-71-bc-a8-4f-43
Nov 28 08:58:09 dolphin in.tftpd[24606]: RRQ from 192.168.0.181 filename pxelinux.cfg/C0A800B5
Nov 28 08:58:09 dolphin in.tftpd[24607]: RRQ from 192.168.0.181 filename pxelinux.cfg/C0A800B
Nov 28 08:58:09 dolphin in.tftpd[24608]: RRQ from 192.168.0.181 filename pxelinux.cfg/C0A800
Nov 28 08:58:09 dolphin in.tftpd[24609]: RRQ from 192.168.0.181 filename pxelinux.cfg/C0A80
Nov 28 08:58:09 dolphin in.tftpd[24610]: RRQ from 192.168.0.181 filename pxelinux.cfg/C0A8
Nov 28 08:58:09 dolphin in.tftpd[24611]: RRQ from 192.168.0.181 filename pxelinux.cfg/C0A
Nov 28 08:58:09 dolphin in.tftpd[24612]: RRQ from 192.168.0.181 filename pxelinux.cfg/C0
Nov 28 08:58:09 dolphin in.tftpd[24613]: RRQ from 192.168.0.181 filename pxelinux.cfg/C
Nov 28 08:58:09 dolphin in.tftpd[24614]: RRQ from 192.168.0.181 filename pxelinux.cfg/default

In most situation, create a default configuration file works well.  There are some situations where we want to force the pxelinux to load menu configuration file other than default.

Here is a DHCP configuration that force pxelinux to load menu pxelinux.cfg/boot:

  1. option space pxelinux;
  2. option pxelinux.magic code 208 = string;
  3. option pxelinux.configfile code 209 = text;
  4. option pxelinux.pathprefix code 210 = text;
  5. option pxelinux.reboottime code 211 = unsigned integer 32;
  6.  
  7. site-option-space "pxelinux";
  8. if exists dhcp-parameter-request-list {
  9.   # Always send the PXELINUX options
  10.   option dhcp-parameter-request-list = concat(option-dhcp-parameter-request-list, "208,209,210,211");
  11. }
  12.  
  13. option pxelinux.configfile      "pxelinux.cfg/boot";
  14. filename "pxelinux.0";

The DHCP option 209 is the option to specify PXELinux config file.  Line 10 specify option additional parameters that will pass to dhcp client.

No comments: