4.5.4 Configuring DHCP to Support iPXE Clients

iPXE extends the capabilities of PXE in many ways, including:

  • iPXE clients can boot using HTTP, iSCSI, AoE, and FCoE

  • The boot process can be controlled using scripts

  • DNS lookup is available

  • Booting across wide area networks or the Internet is possible

The gpxelinux.0 boot loader provides some iPXE features, such as DNS lookup and HTTP file transfer, and is available in the syslinux package. It does not support iPXE commands or scripts.

You can use gpxelinux.0 with BIOS-based PXE clients and with UEFI-based PXE clients in legacy mode but not in UEFI mode.

To configure the DHCP service to support iPXE clients:

  1. Edit the DHCP server configuration template file /etc/cobbler/dhcp.template:

    1. Add the following lines to define the iPXE options for DHCP:

      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.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;
      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;
    2. If you do not use a proxy DHCP server, specify the following line to speed up negotiation with the DHCP server:

      option ipxe.no-pxedhcp 1;
    3. Add the following line to define the user-class option:

      option user-class code 77 = string;
    4. Configure the DHCP server to provide the IP addresses of name servers that iPXE clients can use to resolve domain names to IP addresses, for example:

      option domain-name-servers 192.168.1.1, 192.168.1.4, 192.168.1.8;
    5. Configure DHCP to specify the gpxelinux.0 boot loader for non-iPXE clients and the URI of a boot script for iPXE clients, for example:

      if exists user-class and option user-class = "iPXE" {
            filename "http://web.mydom.com/pxeboot.php";
        } else {
            filename "gpxelinux.0";
        }

      In this example, pure iPXE clients run the HTTP-served boot script pxeboot.php.

      The following is an example of a boot script for an iPXE client:

      #!ipxe
      
      dhcp
      kernel http://swksvr.mydom.com/distro-trees/ol6u6-x86_64-server/images/pxeboot/vmlinuz
      initrd http://swksvr.mydom.com/distro-trees/ol6u6-x86_64-server/images/pxeboot/initrd.img
      boot vmlinuz initrd=initrd.img ksdevice=bootif lang=en_US kssendmac text \
      ks=http://192.168.1.3/cblr/svc/op/ks/profile/ol6-x86_64-minimal:1:SpacewalkDefaultOrganization

      dhcp configures the client's network interfaces.

      kernel downloads the installation kernel.

      initrd downloads the initial ram-disk image file.

      boot boots the downloaded installation kernel. Boot line parameters, such as the name of the initial ram-disk file and the location of the Kickstart file, are specified as additional arguments.

      Do not use the \ line-continuation character. This character is used in the example to denote that the line has been broken for printing. The boot command and all of its arguments must be on the same line.

      For more information, see http://ipxe.org/scripting and http://ipxe.org/cmd.

      Non-iPXE clients boot using gpelinux.0. A configuration file for gpxelinux.0 is named in the same way as for pxelinux.0 as described in Section 4.5.3, “About Boot-Loader Configuration Files”. Unlike pxelinux.0, you can use HTTP to access the installation kernel and initial ram-disk image files.

      The following is an example of a configuration file for gpxelinux.0:

      prompt 0
      default ol6u6
      timeout 0
      
      label ol6u6
      kernel http://swksvr.mydom.com/distro-trees/ol6u6-x86_64-server/images/pxeboot/vmlinuz
      append initrd=http://swksvr.mydom.com/distro-trees/ol6u6-x86_64-server/images/pxeboot/initrd.img \
      ksdevice=bootif lang=en_US kssendmac text \
      ks=http://192.168.1.3/cblr/svc/op/ks/profile/ol6-x86_64-minimal:1:SpacewalkDefaultOrganization
      ipappend 2

      Do not use the \ line-continuation character. This character is used in the example to denote that the line has been broken for printing. The append keyword and all of its arguments must be on the same line.

  2. Run the cobbler sync command:

    # cobbler sync
    task started: YYYY-MM-DD_hhmmss_sync
    task started (id=Sync, time=date)
    ...
    rendering DHCP files
    generating /etc/dhcp/dhcpd.conf
    ...
    *** TASK COMPLETE ***

    The Cobbler service regenerates the /etc/dhcp/dhcpd.conf file and reloads the dhcpd service.

    If you make any further changes to /etc/cobbler/dhcp.template, run the cobbler sync command. You do not need to run this command if you change the content of the boot loader configuration files.