IMD SolutionComputing LibraryShop main store

How-to

Set up a PXE boot server for an industrial PC

Operating systems on the plant floor Published 7 min read

Short answer

Put dnsmasq on an isolated 192.168.0.0/24 segment as its only DHCP server, serve pxelinux.0 and syslinux.efi from the TFTP root, open UDP 67, 69 and 4011, and set the industrial PC's firmware to boot from the network first. A Debian netinst menu arriving over TFTP proves the full DHCP-to-TFTP chain without touching the plant DHCP server.

On this page
  1. What PXE does on the wire
  2. Build the isolated test segment
  3. Install the boot files
  4. Configure dnsmasq
  5. Open the firewall ports
  6. Boot the industrial PC from the network
  7. Worked example: how long one initrd pull takes
  8. If the menu never appears
  9. From bench proof to the plant floor
  10. Questions asked

A bench PXE proof takes one Linux box, dnsmasq and a small switch. Serve pxelinux.0 to BIOS clients and syslinux.efi to 64-bit UEFI clients from 192.168.0.10 over TFTP, open UDP ports 67, 69 and 4011, put the industrial PC's network adapter first in the firmware boot order, and the Debian installer menu on screen proves the whole chain. The plant DHCP server stays untouched, because the test segment has exactly one DHCP server: dnsmasq itself. The steps below build that server on Debian, verify it with a netinst boot, and finish with what belongs on the plant floor instead of the bench.

What PXE does on the wire #

PXE is firmware on the network adapter. At power-on it broadcasts a DHCP discover, a PXE-aware server answers with its own address and the name of a boot file, and the client fetches that file with TFTP and runs it. Because discovery rides DHCP, one segment can carry exactly one address-assigning DHCP server, which is why this setup runs on its own isolated segment rather than the plant network.

Three UDP ports carry the exchange: 67 for the DHCP handshake, 69 for the TFTP transfers, and 4011 for the boot-server reply leg of PXE discovery. Any firewall sitting between the PC and the server must pass all three.

Build the isolated test segment #

Give the server a static address and keep the plant network out of the test. The serving NIC takes 192.168.0.10/24, and dnsmasq hands out leases from 192.168.0.100 to 192.168.0.200, inside the same /24. The boot needs no router: discovery, TFTP and the installer kernel all stay inside 192.168.0.0/24. A second NIC or Wi-Fi link may reach the plant network for package downloads and SSH, but nothing bridges it onto the PXE segment.

On Raspberry Pi OS the static address lives in /etc/dhcpcd.conf as interface eth0 with static ip_address=192.168.0.10/24; on plain Debian, use the distribution's normal network configuration.

Part Address or interface Role
PXE server, serving NIC 192.168.0.10/24 on eth0 The segment's only DHCP server; dnsmasq and the TFTP root /mnt/data/netboot run here
PXE server, second NIC or Wi-Fi Plant network side Package downloads and SSH only; never bridged onto the segment
Industrial PC under test Lease from 192.168.0.100 to 192.168.0.200 Wired to the segment switch; firmware set to network boot

Install the boot files #

Install dnsmasq, the pxelinux loader, the EFI64 loader files and ufw:

sudo apt-get update && sudo apt-get install dnsmasq pxelinux syslinux-efi ufw

Create the TFTP tree and copy the BIOS and 64-bit EFI loaders into it:

sudo mkdir -p /mnt/data/netboot/{bios,efi64}
sudo cp /usr/lib/syslinux/modules/bios/{ldlinux,vesamenu,libcom32,libutil}.c32 /usr/lib/PXELINUX/pxelinux.0 /mnt/data/netboot/bios
sudo cp /usr/lib/syslinux/modules/efi64/ldlinux.e64 /usr/lib/syslinux/modules/efi64/{vesamenu,libcom32,libutil}.c32 /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi /mnt/data/netboot/efi64

Stage a Debian netinst image as the proof load. Place the ISO at /mnt/data/isos/debian-11.4.0-amd64-netinst.iso (the bench example uses Debian 11.4.0; substitute the release you target), then extract it into the tree:

sudo mount -o loop -t iso9660 /mnt/data/isos/debian-11.4.0-amd64-netinst.iso /media
sudo rsync -av /media/ /mnt/data/netboot/boot/amd64/debian/11
sudo umount /media

Write the shared boot menu as the file default inside /mnt/data/netboot/pxelinux.cfg, the path pxelinux reads first:

MENU TITLE PXE Boot Menu
DEFAULT vesamenu.c32
LABEL local
MENU LABEL Boot from local drive
LOCALBOOT 0xffff
MENU BEGIN amd64
MENU TITLE amd64
MENU BEGIN Debian
MENU TITLE Debian
LABEL installgui
MENU LABEL ^Graphical install
KERNEL ::boot/amd64/debian/11/install.amd/vmlinuz
APPEND vga=788 initrd=::boot/amd64/debian/11/install.amd/gtk/initrd.gz --- quiet
LABEL install
MENU LABEL ^Install
KERNEL ::boot/amd64/debian/11/install.amd/vmlinuz
APPEND vga=788 initrd=::boot/amd64/debian/11/install.amd/initrd.gz --- quiet
MENU END
MENU END

The :: prefix means the path starts at the TFTP root rather than at the menu's own directory. Link both loader trees to the one menu directory, so BIOS and EFI clients read the same file:

cd /mnt/data/netboot
sudo ln -rs pxelinux.cfg bios
sudo ln -rs pxelinux.cfg efi64

Configure dnsmasq #

Replace /etc/dnsmasq.conf with:

port=0
interface=eth0
dhcp-range=192.168.0.100,192.168.0.200,12h
enable-tftp
tftp-root=/mnt/data/netboot
pxe-service=x86PC,"PXELINUX (BIOS)",bios/pxelinux.0
pxe-service=x86-64_EFI,"PXELINUX (EFI)",efi64/syslinux.efi
log-queries
log-facility=/var/log/dnsmasq.log

Line by line:

  • port=0 turns DNS off; the box serves only DHCP and TFTP.
  • interface=eth0 binds every service to the isolated segment's NIC.
  • dhcp-range makes dnsmasq the segment's DHCP server: addresses 192.168.0.100 through 192.168.0.200 with 12 h leases.
  • enable-tftp with tftp-root points TFTP at the boot tree.
  • The two pxe-service lines are the architecture switch: a client whose PXE firmware reports x86PC is handed bios/pxelinux.0, and one reporting x86-64_EFI is handed efi64/syslinux.efi. One server therefore serves BIOS and 64-bit UEFI machines side by side.
  • log-queries with log-facility sends every request to /var/log/dnsmasq.log, the file you will read when a client stalls.

Use ordinary ASCII quotation marks in the file; smart quotes from a document paste break the pxe-service lines.

Open the firewall ports #

Allow the three PXE ports and restart the service:

sudo ufw allow 67/udp
sudo ufw allow 69/udp
sudo ufw allow 4011/udp
sudo systemctl restart dnsmasq

Port 67 carries the DHCP handshake, 69 carries TFTP, and 4011 carries the boot-server replies of PXE discovery. With all three open on the segment, nothing between client and server needs touching again.

Boot the industrial PC from the network #

  1. Wire the PC to the segment switch. The client leg must be wired; the isolated segment has no wireless path.
  2. Power the machine into its firmware setup and enable the network boot option. This setting turns on the adapter's boot ROM; vendors place it in different boot pages, so look for the entry that mentions network or PXE boot rather than expecting one universal menu path.
  3. Move the network adapter to the top of the boot order, ahead of the internal drive.
  4. Save the settings and reboot.
  5. Watch the screen during the boot: the PXE firmware prints its discovery progress, the adapter's DHCP request, and the boot file it receives.
  6. Select Install from the PXE Boot Menu. The Debian installer's first screens are the pass condition: DHCP discovery answered, boot file delivered over TFTP, and the loader running. The installer later asks for a package mirror this isolated segment cannot reach; the proof ends at those first screens.

Worked example: how long one initrd pull takes #

The inputs below are illustrative example inputs, not measured results: an initrd.gz of 32 MiB and a round-trip time of 5 ms between client and server on a short wired segment. Classic TFTP sends 512-byte blocks and waits for each acknowledgement before the next block, so one block costs one round trip:

  • 32 MiB = 32 x 1,048,576 = 33,554,432 bytes.
  • Blocks: 33,554,432 / 512 = 65,536.
  • Time: 65,536 x 5 ms = 327,680 ms, about 5.5 minutes.
  • Effective rate: 512 B / 5 ms = 102,400 B/s, about 102 kB/s.

Where the firmware or loader negotiates the TFTP block-size option, a 1468-byte block is the largest that fits one 1500-byte frame: 1500 - 20 IP - 8 UDP - 4 TFTP header = 1468. At that block size the same file needs 33,554,432 / 1468 = about 22,858 blocks, which takes 22,858 x 5 ms = about 114 seconds, roughly 294 kB/s.

The decision this buys: a kernel-and-initrd pull measured in minutes is the stop-and-wait signature, not a broken server. Keep the client wired to the same switch to hold the round trip down, and prefer firmware that negotiates the larger block size when pull time dominates boot time.

If the menu never appears #

  • A second DHCP server on the segment is the most common cause. Disconnect the plant-side leg completely; dnsmasq must be the only DHCP answer the client hears.
  • Read /var/log/dnsmasq.log. A client MAC appearing in the log means the handshake works; file-not-found entries in the TFTP records point at a path typo between the pxe-service lines and the tree on disk.
  • Match firmware mode to the pxe-service tag: a BIOS-only client needs the x86PC entry, a 64-bit UEFI client needs the x86-64_EFI entry. A mismatch leaves the client asking, receiving nothing useful, and timing out.
  • Confirm the firewall rules survived a restart of the server: UDP 67, 69 and 4011 all still allowed.
  • A client that shows no discovery progress at all is usually on the wrong port or VLAN; verify the cable reaches the segment switch and not the plant network.

From bench proof to the plant floor #

The netinst boot proves the transport, not the production design. For what comes after the bench:

One safety rule closes the bench phase: a PXE server is a code path into every machine that boots from it, so keep the segment isolated, serve only images you have booted and verified on the bench, and leave a machine's firmware pointing at local disk unless you control the server behind it.

Questions asked

Can dnsmasq run beside the plant DHCP server?

Yes, in proxy mode. Replace the address range on the dhcp-range line with the word proxy, so dnsmasq answers only the PXE portion of the handshake and the plant server keeps assigning addresses. Both servers must sit on the same segment, the same pxe-service lines apply, and UDP 67, 69 and 4011 still must reach the PXE server. Prove the setup on an isolated segment first, because a wrong DHCP answer on the plant network can leave machines waiting at boot.

How many PCs can boot from one server at once?

The example lease range 192.168.0.100 through 192.168.0.200 holds (200 - 100) + 1 = 101 addresses, so 101 machines can hold leases at the same time. The tighter limit is TFTP: every client pulls its own kernel and initrd independently, and a full-line power-up makes them all pull in the same minute. Spread the boot across groups or split large lines onto a second segment if the pull time in the worked example would run past your maintenance window.

Does network boot replace the internal drive?

No. PXE only takes precedence while the network adapter sits first in the firmware boot order; the drive and its installation are untouched. After the bench proof, move local disk back to the top so the machine still boots normally whenever the PXE server is powered off. A permanent diskless design is different: the served system then has to live on the server and survive every boot, which is a sizing and licensing decision of its own.

Can one server serve BIOS and UEFI machines together?

Yes, and the example does exactly that. The x86PC tag hands bios/pxelinux.0 to BIOS firmware and the x86-64_EFI tag hands efi64/syslinux.efi to 64-bit UEFI firmware, from the same dnsmasq instance. Both loader trees link to one pxelinux.cfg directory, so one menu file serves both generations; keep that shared menu free of entries only one firmware type can execute. When a machine fetches nothing, compare its firmware mode against these two tags first.

Keep reading

  • Selection guide

    Choosing an operating system image for an industrial PC

    Order the industrial PC with the vendor image closest to your runtime: Windows IoT Enterprise LTSC where the vendor documents it for your model, the vendor's qualified Linux for a Linux stack, or the BSD image if your code builds on FreeBSD. Bring-your-own images are the fallback for monitoring-class loads. Qualify your binaries on the exact model and image; support and real-time behavior are model-specific.

    Operating systems on the plant floor

  • How-to

    Running TwinCAT XAR on a third-party industrial PC

    Do not clone a factory IPC image onto other hardware. Install a licensed Windows 10 IoT Enterprise LTSC edition, install the runtime fresh, and qualify the real-time Ethernet port, CPU priority and jitter on the actual machine. A successful boot proves nothing, and network hardware the runtime vendor did not sell you is a self-supported component.

    Operating systems on the plant floor

  • Comparison

    TwinCAT on a third-party PC: license class and NIC checks

    TwinCAT runs on third-party PCs, but licensing for such hardware is assigned the highest performance class, which raises license cost. Before moving the project: verify the exact Ethernet controller against the supported-network-controller list, and for motion or fast I/O validate the PC's clock and real-time behavior under load. If those checks fail, a Beckhoff IPC costs less overall.

    Operating systems on the plant floor