Currently Available: Need a skilled Software Developer for your next project?
Categories
Self-Hosting

How to Set Up a PXE Network Boot Server for OS Installs in a Home Lab

A PXE server lets a computer start an operating-system installer over Ethernet instead of from a USB drive. PXE, short for Preboot Execution Environment, is a firmware feature that starts a machine from files on the network. First, the server points the client to a bootloader, the small program that starts the installer. Once the bootloader runs, the installer downloads the larger operating-system files, usually over HTTP.

Before you install any software, decide which device on your home lab network will run DHCP, the service that assigns IP addresses. If your router already hands out addresses, you can keep it in charge and either add PXE options on the router or run a proxy-DHCP service alongside it. If you use a separate network reserved for installs, you can let the PXE server handle DHCP itself. In either case, you need to match the boot files to each client’s firmware and CPU architecture.

Choose how the lab will provide DHCP

Start by deciding which device will assign addresses to the computers you plan to install.

If your home router already provides DHCP, avoid adding a second, standard DHCP server to the same network without a deliberate plan. Two DHCP servers on one network can hand out conflicting settings to clients. When your router supports PXE options, configure it to provide the network-boot information directly. When it does not, run dnsmasq, a lightweight DNS and DHCP service, in proxy-DHCP mode. In that mode, the router still assigns IP addresses while dnsmasq supplies the network-boot details. The dnsmasq manual covers both proxy-DHCP and full DHCP operation.

If you run a separate lab subnet, dnsmasq can assign addresses and provide PXE information on its own. Put that subnet on an isolated VLAN (a separate logical network), a dedicated switch, or a separate physical network so dnsmasq cannot answer requests from devices on the rest of your home network. Set dnsmasq as authoritative only when it is the sole DHCP server on that network.

Give the PXE host a stable IP address on the lab network. Bind its DHCP and boot services to the correct network interface, and verify that the address pool matches your subnet. Treat the values in distribution documentation as examples, and replace them with settings that fit your own network.

Serve boot files over TFTP and installation files over HTTP

PXE splits an installation into two stages. First, the client uses DHCP to learn where its initial boot file lives, then downloads that file over TFTP, a simple file-transfer protocol. The bootloader loads the installer’s kernel, the core program that runs the operating system, along with its initial RAM disk, a temporary filesystem the installer uses while starting up. Next, the installer fetches the larger operating-system image or package repository, usually over HTTP. The Ubuntu netboot instructions show this split between early boot files and the installation source.

You can run these services on a Linux host or a virtual machine. Use dnsmasq for DHCP or proxy-DHCP, and either enable its built-in TFTP server or run a separate TFTP service such as tftpd-hpa. Pick one TFTP server for your boot files. If you run two at the same time without a specific reason, you will have a harder time telling which service answers a client. Ubuntu’s instructions include both dnsmasq TFTP settings and a separate TFTP service, so treat them as alternatives and stick to one configuration.

Keep the TFTP directory limited to the files clients need to boot. Ubuntu’s instructions, for example, use /srv/tftp as a sample TFTP root, the directory where the TFTP server looks for boot files. TFTP has no login or access-control mechanism, so expose it only on your lab interface and keep unrelated files out of that directory. The protocol’s security considerations explain this limitation.

Host the ISO or installation repository on an HTTP server that the installer can reach, and point the bootloader configuration to that source. Kernel parameters and directory layouts vary by operating system and release. Follow the current network-install instructions for the distribution you plan to install, because parameters written for Ubuntu do not automatically work for Red Hat Enterprise Linux.

Match the bootloader to the client

When your lab includes both legacy BIOS (the older PC firmware standard) and UEFI (the newer firmware standard) machines, prepare separate boot paths for each. BIOS systems commonly use PXELINUX, while UEFI systems require an EFI bootloader that matches their architecture. A boot file built for x86-64 will not automatically work on ARM64.

UEFI firmware can also enforce Secure Boot, which checks whether boot components carry signatures the firmware trusts. When Secure Boot is enabled on a client, use a boot chain documented as compatible with it, because a custom bootloader path is not automatically compatible.

A client’s DHCP request includes an architecture identifier in option 93, which the server can use to pick the right boot file. Check that the numeric value in your configuration matches the value the client actually sends, because a descriptive label alone does not confirm a match. RFC 4578 assigns different identifiers to different x86 firmware types, and the Ubuntu example’s match value and label are worth checking against your client’s real request. Test each firmware mode instead of copying an architecture match blindly.

If you are installing Ubuntu, follow the current instructions for your specific release and architecture. Check the bootloader download path before you use it, since the Ubuntu example includes a legacy BIOS file path from an older release archive alongside newer installation instructions. Make sure the bootloader, kernel, and initial RAM disk all come from the same intended installer.

Build and test one boot path

Get one operating-system installer working on one test client before you add boot menus or support more machines. A practical order of steps looks like this:

  1. Give the server a stable IP address and decide whether the router or the PXE host will handle DHCP.
  2. Configure dnsmasq to bind to the lab interface and hand out the boot information. Use proxy-DHCP when the router stays in charge of IP addresses.
  3. Place the right BIOS or UEFI bootloader, its configuration, and the installer’s kernel and initial RAM disk in the TFTP root.
  4. Host the ISO or installation repository over HTTP and point the bootloader configuration to that URL.
  5. Connect the test client over Ethernet, enable network boot in its firmware or one-time boot menu, and watch each step as the client gets an address and pulls down the installer files.

You need a PXE-capable Ethernet interface for this setup. Red Hat’s RHEL 8 PXE instructions call for a physical network connection because Wi-Fi does not carry the classic firmware PXE boot exchange. UEFI HTTP Boot is a separate method that you can use only when the client’s firmware supports it.

Trace failures through the boot sequence

When a boot fails, start by finding the stage where the client stops. If it never gets an IP address, confirm that it is plugged into the right network, that the intended DHCP service is answering, and that dnsmasq is listening on the correct interface.

If the client gets an address but cannot download a boot file, check the advertised filename, the TFTP server address, the file location, and the TFTP root directory. If the bootloader starts but the installer does not, verify that the bootloader configuration points to the right kernel and initial RAM disk for that client’s architecture. If the installer starts but cannot find the operating-system source, check the URL and confirm that the installer can reach your HTTP server.

When one firmware mode works and another fails, inspect which boot file the server chose for each client and verify the architecture identifier the client reported. If you use iPXE, a network boot program, and the client keeps reloading iPXE in a loop, the server may be handing it the same iPXE file again after its second DHCP request. The iPXE chainloading documentation explains how to break that loop by changing the second handoff.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *