Using ISC dhcpd

ISC dhcpd is the default DHCP server on most Linux distributions. It can easily be configured to support iPXE.

ISC dhcpd is configured using the file /etc/dhcpd.conf. You can instruct iPXE to boot using the filename directive:

  filename "pxelinux.0";

or

  filename "http://boot.ipxe.org/demo/boot.php";

To boot from a SAN, you must use the option root-path directive instead of filename:

  filename "";
  option root-path "iscsi:iscsi.example.com::::iqn.1992-01.com.example.iscsi:target";

or

  filename "";
  option root-path "aoe:e0.0";

PXE chainloading

A chain

To use PXE chainloading, you need to set up ISC dhcpd to hand out one of undionly.kpxe or ipxe.efi to legacy PXE clients, and then hand out the “real” boot configuration only to iPXE clients. You can do this by telling ISC dhcpd to use different configurations based on the DHCP user class:

  option client-architecture code 93 = unsigned integer 16;
  if exists user-class and option user-class = "iPXE" {
      filename "http://my.web.server/real_boot_script.php";
  } elsif option client-architecture = 00:00 {
      filename "undionly.kpxe";
  } else {
      filename "ipxe.efi";
  }

This will ensure that the iPXE image (undionly.kpxe) is handed out only when the DHCP request comes from a legacy PXE client. Once iPXE has been loaded, the DHCP server will direct it to boot from http://my.web.server/real_boot_script.php. You should replace filename "http://my.web.server/real_boot_script.php" with whatever you want iPXE to boot from. For example, if you want to chainload into iPXE and then boot from an iSCSI target, you could use:

  option client-architecture code 93 = unsigned integer 16;
  if exists user-class and option user-class = "iPXE" {
      filename "";
      option root-path "iscsi:iscsi.example.com::::iqn.1992-01.com.example.iscsi:target";
  } elsif option client-architecture = 00:00 {
      filename "undionly.kpxe";
  } else {
      filename "ipxe.efi";
  }

iPXE-specific options

There are several DHCP options that are specific to iPXE and that are not recognised by the standard ISC dhcpd installation. To add support for these options, place the following at the start of your /etc/dhcpd.conf:

  option space ipxe;
  option ipxe-encap-opts code 175 = encapsulate ipxe;
  option ipxe.priority code 1 = signed integer 8;
  option ipxe.keep-san code 8 = unsigned integer 8;
  option ipxe.skip-san-boot code 9 = unsigned integer 8;
  option ipxe.syslogs code 85 = string;
  option ipxe.cert code 91 = string;
  option ipxe.privkey code 92 = string;
  option ipxe.crosscert code 93 = string;
  option ipxe.no-pxedhcp code 176 = unsigned integer 8;
  option ipxe.bus-id code 177 = string;
  option ipxe.san-filename code 188 = string;
  option ipxe.bios-drive code 189 = unsigned integer 8;
  option ipxe.username code 190 = string;
  option ipxe.password code 191 = string;
  option ipxe.reverse-username code 192 = string;
  option ipxe.reverse-password code 193 = string;
  option ipxe.version code 235 = string;
  option iscsi-initiator-iqn code 203 = string;
  # Feature indicators
  option ipxe.pxeext code 16 = unsigned integer 8;
  option ipxe.iscsi code 17 = unsigned integer 8;
  option ipxe.aoe code 18 = unsigned integer 8;
  option ipxe.http code 19 = unsigned integer 8;
  option ipxe.https code 20 = unsigned integer 8;
  option ipxe.tftp code 21 = unsigned integer 8;
  option ipxe.ftp code 22 = unsigned integer 8;
  option ipxe.dns code 23 = unsigned integer 8;
  option ipxe.bzimage code 24 = unsigned integer 8;
  option ipxe.multiboot code 25 = unsigned integer 8;
  option ipxe.slam code 26 = unsigned integer 8;
  option ipxe.srp code 27 = unsigned integer 8;
  option ipxe.nbi code 32 = unsigned integer 8;
  option ipxe.pxe code 33 = unsigned integer 8;
  option ipxe.elf code 34 = unsigned integer 8;
  option ipxe.comboot code 35 = unsigned integer 8;
  option ipxe.efi code 36 = unsigned integer 8;
  option ipxe.fcoe code 37 = unsigned integer 8;
  option ipxe.vlan code 38 = unsigned integer 8;
  option ipxe.menu code 39 = unsigned integer 8;
  option ipxe.sdi code 40 = unsigned integer 8;
  option ipxe.nfs code 41 = unsigned integer 8;

Speeding up DHCP

The PXE specification requires iPXE to wait for replies from a ProxyDHCP server before booting. If you are not using a ProxyDHCP server, then this creates an unnecessary delay of several seconds. You can eliminate this delay using:

  option ipxe.no-pxedhcp 1;

(Do not do this if you are using a ProxyDHCP server; it will cause iPXE to ignore whatever the ProxyDHCP server sends!)

Testing for specific features

You can use the feature indicator options to determine whether or not iPXE supports a specific feature. For example,

  if exists ipxe.fcoe {
      option root-path "fcp:20:00:52:54:00:aa:b7:01:0";
  }

would hand out an FCoE root path only to iPXE clients with FCoE support enabled.

howto/dhcpd.txt · Last modified: 2021/02/13 17:53 by mcb30
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL https://ipxe.org
References to "iPXE" may not be altered or removed.