Add PXE UEFI Support in Linux PXE Server

Share on Social Media

In this tutorial, you will learn, how to Add PXE UEFI Support in Linux PXE Server. #centlinux #linux #pxe

UEFI vs BIOS:

BIOS (Basic Input/Output System) and UEFI (Unified Extensible Firmware Interface) are two firmware interfaces for computer systems which work as an interpreter between the operating system and the computer firmware. Both of these are installed at the time of manufacturing and is the first program that runs when a computer is turned on. BIOS uses the Master Boot Record (MBR) to save information about the hard drive data while UEFI uses the GUID partition table (GPT).

MBR uses 32-bit entries in its table which limits the total physical partitions to only 4 with maximum size of 2 TB each. Whereas, GPT uses 64-bit entries in its table which allows it use more than 4 physical partitions with larger sizes.

Problem Statement:

In our previous article Setup a PXE Boot Server in CentOS 7, we have configured a PXE boot server and added the RHEL 7.5 installation option in it. The configuration worked fine with BIOS based computer systems, but didn’t support UEFI based clients.

In this article, we will add UEFI support to our PXE Boot Server on CentOS 7.

Note: In this article, we are performing everything from CLI, therefore, it is highly recommended that, you should have Linux Pocket Guide: Essential Commands (PAID LINK) for quick reference.

System Specification:

We use the same CentOS 7 server that we have configured as PXE Boot Server in our previous article. The specifications have been re-mentioned below for convenience of the readers.

  • CPU – 2 Core (2.4 Mhz)
  • Memory – 2 GB
  • Storage – 50 GB
  • Operating System – CentOS 7.5
  • Hostname – pxe-server.itlab.com
  • IP Address – 192.168.116.41/24

Add PXE UEFI support in Linux PXE Server:

Connect to pxe-server.itlab.com using ssh.

Adjust DHCP server configuration to support UEFI systems.

# vi /etc/dhcp/dhcpd.conf

Search for following lines in the above file.

#PXE boot server
next-server 192.168.116.41;
filename "pxelinux.0";

Replace above lines with following configurations.

class "pxeclients" {
          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
          next-server 192.168.116.41;

          if substring (option vendor-class-identifier, 15, 5) = "00009" {
            filename "grubx64.efi";
            } else {
            filename "pxelinux.0";
        }
    }

Restart dhcpd.service to apply changes.

# systemctl restart dhcpd.service

If dhcpd.service gives error during startup, then look for any possible syntax errors therein and try to restart the service again.

For more details on comparisons in the above configurations, please refer to RFC 4578 – Dynamic Host Configuration Protocol (DHCP) Options for the Intel Preboot eXecution Environment (PXE).

Now, we need a bootloader (such as grubx64.efi) to support UEFI clients. This bootloader is available in CentOS 7.5 ISO.

Copy grubx64.efi to /var/lib/tftpboot directory.

# cp /var/ftp/pub/rhel7/EFI/BOOT/grubx64.efi /var/lib/tftpboot/

Our PXELINUX menu does not work for UEFI systems, therefore we have to create another menu for the UEFI clients.

The menu filename is grub.cfg and it is located at /var/lib/tftpboot. Therefore, we will define RHEL 7.5 installation option in this file as follows:

# cat >> /var/lib/tftpboot/grub.cfg << EOF
> set timeout=60
>
> menuentry 'Install RHEL 7.5' {
>         linuxefi /networkboot/rhel7/vmlinuz inst.repo=ftp://192.168.116.41/pub/rhel7/
>         initrdefi /networkboot/rhel7/initrd.img
> }
> EOF

Restart tftp.service to apply changes.

# systemctl restart tftp.service

UEFI configurations has been completed.

To test the configurations, connect a UEFI based system to network, and turn it on.

UEFI-PXE-boot-menu

The UEFI client will fetch the above menu from PXE boot server.

Press <ENTER> to start installation.

rhel-7-Installation-Language

Our PXE boot Server is now supports both BIOS and UEFI based clients.

Conclusion:

We have successfully added PXE UEFI support in our PXE boot Server on CentOS 7.