As I’ve mentioned a few times before, I’m currently building a nice PXE-based platform for testing and imaging machines at work. Building a PXE server is relatively straight-forward, but it takes some understanding of how PXE works.
How PXE booting works
PXE (Preboot eXecution Environment) is a standard way to boot a client device over a standard network connection. PXE works by following a defined method to send a ‘bootstrap’ to the client machine, which then completes the boot process.
The procedure for PXE is pretty simple when you’re booting Linux:
- Compatible device boots, and the option ROM in the NIC attempts to get a DHCP lease. If it is successful, the DHCP server gives the client device the name of a file to boot from.
- The client device connects to a TFTP (Trivial FTP) and attempts to download the file. If the download is successful, it will begin to boot from the file if it is possible.
- The bootable file either contains or refers to a set of parameters to create a bootstrap, frequently initramfs and vmlinuz files, along with some configuration for the root filesystem.
- The initramfs and vmlinuz files are downloaded by the client and control is handed off to the bootstrap as it loads the rootfs over the network (usually NFS or HTTP).
In this guide, I’ll be showing you how to make a PXE boot server on Ubuntu 16.04. The same methods should work on newer versions without much issue, though.
PXE booting isn’t terribly hardware intensive, especially if a little bit of a wait is acceptable. The only real hardware issue is that, since PXE uses DHCP, being able to isolate network ports can be extremely useful. DHCP can temporarily take down a whole network due to the way it works, so be careful about doing anything involving it without understanding what you’re doing!
The software requirements for PXE are pretty light. We’ll be using:
Yeah, really, only 3 pieces of software are required for a basic PXE server. Once you get that stuff installed, check out part 2!