Purpose: boot an emulated machine from the network, with udedhcpd
handing out the boot file and udetftpd serving it.
A PC boots from the network with PXE: its network card's boot ROM asks
DHCP for an address, the address of a TFTP server and the name of a
file, then loads that file with TFTP and runs it. The file is a small
boot loader such as PXELINUX or iPXE, which loads a kernel and an initial
RAM disk the same way. On a UDE network, udedhcpd -B -b answers the
first question and udetftpd serves the files, without root and
without touching the host's network.
scale = 0.85 Q: box "QEMU" "PXE ROM (iPXE)" fit S: box "udeswitch" "-T 0" fit at Q + (2.2, 0) D: box "udedhcpd" "10.0.0.1" fit at S + (2.2, 0.6) T: box "udetftpd" "10.0.0.2" fit at S + (2.2, -0.6) line from Q.e to S.w line from S.e to D.w line from S.e to T.w text "1. DHCP: an address, the TFTP" ljust at D.e + (0.2, 0.12) text "server (-B) and the boot file (-b)" ljust at D.e + (0.2, -0.12) text "2. TFTP: the boot loader, its" ljust at T.e + (0.2, 0.12) text "configuration, the kernel, the initrd" ljust at T.e + (0.2, -0.12)→ /pikchrshow
The example below boots the Debian installer in QEMU, first with PXELINUX, then with an iPXE script. It was run as written; see What was tested.
What you need
- UDE built with the protocol libraries (the default):
udeswitch,udedhcpdandudetftpd. - QEMU 7.2 or later, for
-netdev dgram; its network cards boot with iPXE ROMs, which Debian ships inipxe-qemu. KVM is not needed. - Files to boot. Debian's network installer comes as one archive with the kernel, the initrd and PXELINUX:
mkdir -p netboot/root && cd netboot
curl -LO https://deb.debian.org/debian/dists/trixie/main/installer-amd64/current/images/netboot/netboot.tar.gz
tar -xzf netboot.tar.gz -C root
The archive's pxelinux.cfg/default is a symbolic link into
debian-installer/amd64/; udetftpd follows links that stay inside its
root. Its menu waits on the VGA screen; for a serial console that boots
at once, replace the link with a file of your own:
rm root/pxelinux.cfg/default # pxelinux.cfg is a link: this removes the link inside it
cat > root/debian-installer/amd64/pxelinux.cfg/default <<'CFG'
SERIAL 0 115200
DEFAULT install
PROMPT 0
TIMEOUT 0
LABEL install
KERNEL debian-installer/amd64/linux
APPEND initrd=debian-installer/amd64/initrd.gz console=ttyS0,115200 ---
CFG
Boot with PXELINUX
Start a switch, a DHCP server that names the TFTP server and the boot
file, and the TFTP server. QEMU sends no keepalives, so give the switch
-T 0:
udeswitch -T 0 &
udedhcpd -a 10.0.0.1/24 -B 10.0.0.2 -b pxelinux.0 &
udetftpd -a 10.0.0.2/24 -r root &
Then boot a machine from its network card (-boot n):
L=local.type=inet,local.host=127.0.0.1,local.port=7601
R=remote.type=inet,remote.host=127.0.0.1,remote.port=7500
qemu-system-x86_64 -m 1024 -boot n -serial stdio -display none \
-netdev dgram,id=n0,$L,$R -device e1000,netdev=n0,mac=52:54:00:12:34:56
Add -accel kvm where KVM is available. Within seconds udedhcpd
logs the offer with its boot file, and udetftpd every file PXELINUX
asks for:
udedhcpd: DHCP: DHCPACK 10.0.0.100 to 52:54:00:12:34:56, boot file pxelinux.0
udetftpd: TFTP: RRQ pxelinux.0 from 10.0.0.100:24694, octet, blksize 1432, window 1 (options acknowledged)
udetftpd: TFTP: RRQ ldlinux.c32 from 10.0.0.100:49152, octet, blksize 1408, window 1 (options acknowledged)
udetftpd: TFTP: RRQ pxelinux.cfg/01-52-54-00-12-34-56 from 10.0.0.100:49153: file not found
...
udetftpd: TFTP: RRQ pxelinux.cfg/default from 10.0.0.100:49162, octet, blksize 1408, window 1 (options acknowledged)
udetftpd: TFTP: sent debian-installer/amd64/linux to 10.0.0.100:49163, 12171200 bytes in 8645 blocks, 1105 ms, 0 retransmitted
udetftpd: TFTP: sent debian-installer/amd64/initrd.gz to 10.0.0.100:49164, 40761958 bytes in 28951 blocks, 3694 ms, 0 retransmitted
The "file not found" lines are normal: PXELINUX looks for a
configuration named after the machine's MAC address, then after its IP
address in hexadecimal, shorter and shorter, before default. To give
one machine its own menu, create the file it asks for first. The
installer then starts on the serial console with its "Select a
language" screen.
Boot with an iPXE script
The ROM in QEMU's network cards is iPXE, which can load a kernel itself
and follow a script. iPXE says who it is in its DHCP requests (user
class iPXE), so udedhcpd can give it a script while other clients
keep pxelinux.0; ipxe= entries are chosen first:
udedhcpd -a 10.0.0.1/24 -B 10.0.0.2 -b ipxe=boot.ipxe -b pxelinux.0 &
root/boot.ipxe:
#!ipxe
echo Booting Debian installer from ${next-server} over TFTP
kernel tftp://${next-server}/debian-installer/amd64/linux console=ttyS0,115200 initrd=initrd.gz
initrd tftp://${next-server}/debian-installer/amd64/initrd.gz
boot
${next-server} is the address given with -B. The same qemu
command boots it; udetftpd logs three files, boot.ipxe, the kernel
and the initrd.
The same setup in a configuration file
Both servers read the configuration file, so the switch address, the boot files and the root are written once:
[global]
connection = "udp://127.0.0.1:7500"
[udedhcpd]
subnet = "10.0.0.1/24"
next_server = "10.0.0.2"
boot_file = ["ipxe=boot.ipxe", "pxelinux.0"]
[udetftpd]
address = "10.0.0.2/24"
root = "root" # relative to this file
udedhcpd -C netboot.toml &
udetftpd -C netboot.toml &
Other machines and firmware
- UEFI. A UEFI client sends its architecture (option 93), so one
server can serve both kinds:
-b pxelinux.0 -b efi64=grubx64.efi(Debian's archive hasgrubx64.efiand the GRUB configuration underdebian-installer/amd64/).efi64matches both 7 and 9: RFC 4578 assigns 7 to EFI Byte Code and 9 to x64 UEFI, but firmware often sends 7 for a 64-bit UEFI client, soefi64covers both. A numeric class (-b 9=...) matches only that architecture and is chosen beforeefi64. This was not tried in QEMU with OVMF. - Other operating systems. Anything that boots over TFTP works the
same way: put its boot loader in the root and name it with
-b. Windows boot files ask for names with backslashes, whichudetftpdtakes as slashes. - 86Box, real machines. A machine on a TAP interface
(udetap) reaches
udetftpdlike any other host; this was tried with the host's owntftpandcurlclients, not yet with a real PXE ROM or 86Box.
Troubleshooting
- Nothing happens. Start the switch with
-T 0(or a large-T): QEMU sends no keepalives, and a port that has been quiet is removed. Check that QEMU'sremote.portis the switch's port. - "No configuration methods succeeded" from iPXE: no DHCP offer
arrived; is
udedhcpdrunning on the same switch? - "No such file or directory" or error 1 in the client: the name is
relative to
-r, and must not leave it, even through a symbolic link (udetftpdlogsfile not foundoraccess violation). - Slow transfers. Clients choose the block size;
udetftpdallows up to 1468 bytes (-B) and windows of up to 16 blocks (-W). PXELINUX and iPXE use one block at a time, so TCG emulation, not the network, sets the speed.
What was tested
On 1 December 2026, on Debian 13 (x86-64), with QEMU 10.0.13 without
KVM, the e1000 card's iPXE ROM and Debian trixie's netboot.tar.gz
(kernel 6.12): both ways above reached the installer's first screen. With
PXELINUX, udetftpd sent pxelinux.0, ldlinux.c32, the configuration,
the 12 MB kernel and the 40 MB initrd, with no retransmissions; with the
iPXE script, boot.ipxe, the kernel and the initrd. The host's
tftp-hpa client, through udetap, fetched the initrd with 512-byte
blocks (79614 blocks, so the block number wrapped past 65535) byte for
byte, and curl the kernel with 1468-byte blocks.
make test runs udetftpd against an internal TFTP client
(tests/udetftp.c): option negotiation, netascii, block number
rollover, a lost acknowledgment, concurrent transfers, refused names
and requests, and a transfer through a link that loses 10% of the
frames. See udetftpd and
udetftpd(8).