After a PXE network boot, the client downloads a bootloader image via TFTP, which then loads a kernel and initial ramdisk. The system transitions to executing this OS installer or automation script, requiring proper DHCP and DNS resolution to locate the installation media and configuration files.
The Boot Process Flow
PXE (Preboot Execution Environment) is a standard that allows computers to boot from a network interface before the operating system is loaded. This process relies heavily on the interaction between the client NIC firmware, a DHCP server, and a TFTP server. When you initiate a network boot, the first step is obtaining an IP address. The client sends a DHCP Discover packet. The DHCP server responds with an Offer that includes not only an IP address but also specific options. Option 66 specifies the TFTP server hostname, and Option 67 specifies the boot file name. Without these options, the client cannot locate the bootloader.
Once the IP configuration is established, the client attempts to download the specified boot file using the Trivial File Transfer Protocol (TFTP). TFTP is used because it is simple and does not require authentication, making it ideal for pre-boot environments where complex protocols like HTTP are not yet available. The bootloader, often GRUB or iPXE, is fetched from the TFTP server. After the bootloader is in memory, the client executes it. The bootloader’s job is to load the actual operating system kernel and the initial ramdisk (initrd).
Configuration and Automation
In enterprise environments, manual intervention is avoided through automation. Tools like Kickstart for Red Hat-based systems or Preseed for Debian-based systems allow for unattended installations. These configuration files tell the bootloader what packages to install, how to partition disks, and what user accounts to create. The bootloader fetches these text files over HTTP or NFS after loading the kernel. If you are setting up a custom environment, you must ensure your web server or NFS share is accessible from the network segment where the PXE clients reside.
For more advanced networking scenarios, especially those involving VLANs or complex routing, you might encounter issues similar to those described in How can I log intermittent loss of internet?. While PXE itself does not use the general internet, it relies on stable local network connectivity. If packets are dropped during the TFTP transfer, the boot will fail. Monitoring network stability at the switch level is crucial for large-scale deployments.
Using iPXE for Advanced Features
Standard PXE has limitations, such as small maximum file sizes for TFTP and lack of support for HTTPS. iPXE extends the capabilities of the ROM by allowing users to write scripts directly into the NIC’s flash memory. With iPXE, you can chainload from HTTP, HTTPS, or iSCSI. This flexibility is essential when deploying modern operating systems that have larger kernels or require secure boot validation. You can configure iPXE scripts to check for hardware conditions before proceeding with the installation, adding a layer of intelligence to the deployment process.
Troubleshooting Common Issues
If the PXE boot fails, the most common error is "PXE-E32: TFTP open timeout" or "PXE-E3B: TFTP Error." These errors indicate that the client could not reach the TFTP server or retrieve the boot file. First, verify that the DHCP server is correctly configured with Options 66 and 67. Use a tool like Wireshark to capture the DHCP handshake and ensure the options are present in the DHCP Offer packet. Next, check the firewall rules on the TFTP server. TFTP uses UDP port 69. Ensure that this port is open and that the server is listening on the correct interface.
Another frequent issue is mismatched architectures. A 32-bit PXE ROM cannot boot a 64-bit kernel. Ensure that your TFTP server hosts the correct architecture-specific boot files. For example, in a GRUB configuration, you might have separate directories for x86_64 and i386. If the client requests a file that does not exist, it will receive a file-not-found error from TFTP.
Sometimes, the network card driver in the BIOS needs to be updated. Older NICs may have buggy PXE implementations that struggle with large boot images or modern encryption standards. Updating the BIOS and NIC firmware can resolve compatibility issues. Additionally, if you are using virtualization platforms, ensure that the virtual NIC type matches the physical network requirements. Some hypervisors emulate older Intel PRO/1000 cards, while others provide virtio-net drivers which may behave differently during PXE boot.
Security Considerations
PXE is inherently insecure because it transmits data in plaintext. An attacker on the same network segment can perform a rogue DHCP attack to redirect clients to a malicious TFTP server. To mitigate this, use DHCP snooping on managed switches to prevent unauthorized DHCP servers from responding to client requests. This feature ensures that only trusted ports can send DHCP offers. In more secure environments, consider using Secure Boot combined with signed bootloader images. This ensures that only authorized code is executed during the pre-boot phase.
While troubleshooting network issues, it is important to distinguish between PXE failures and general connectivity problems. Unlike browser-based issues discussed in Which ports are used by browsers in peer-to-peer screen sharing?, PXE relies on specific low-level protocols. Confusing TFTP traffic with HTTP traffic can lead to incorrect debugging steps. Remember that TFTP does not support directory listings, so you must know the exact filename to troubleshoot effectively.
Frequently Asked Questions
Can I use HTTP instead of TFTP for PXE booting?
Standard PXE ROMs do not support HTTP; they only support TFTP. However, you can use iPXE, which is a software-based network stack that runs in RAM, to fetch bootloaders via HTTP or HTTPS. This requires flashing the iPXE ROM onto the NIC or using a UEFI network stack that supports HTTP.
What should I do if the PXE boot hangs at 'Loading initial ramdisk'?
This usually indicates that the kernel was loaded but failed to mount the root filesystem. Check the kernel parameters passed via the bootloader configuration. Ensure that the path to the initrd file is correct and that the network configuration in the initrd allows access to the installation source, such as an NFS or HTTP server.
Why does my PXE client get an IP but fail to find the boot file?
This typically means the DHCP server did not include Option 66 (TFTP server IP) or Option 67 (boot file name). Verify the DHCP scope options on your server. Also, check if the TFTP server service is running and if the firewall allows inbound UDP traffic on port 69.
Is PXE boot supported on all modern motherboards?
Most desktop and server motherboards released in the last decade support PXE boot, often referred to as Network Stack or UEFI Network Stack in the BIOS/UEFI settings. However, some ultra-budget or embedded systems may omit this feature to save costs. Check your motherboard manual for references to 'PXE', 'LAN Boot', or 'Network Stack'.
How can I debug PXE boot issues without a monitor?
You can enable verbose logging in your DHCP and TFTP servers. Additionally, use a network sniffer like Wireshark on a machine connected to the same switch to capture the PXE discovery and file transfer packets. Analyzing the capture will reveal if the client is sending requests and if the server is responding correctly.