Purpose: serving boot files to the machines on a switch.
udetftpd is a read-only TFTP server that joins a switch as an IPv4
host, like udedhcpd. Every option is in
udetftpd(8); the full example is
Network booting.
A first server
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 /srv/tftp &
-a is the server's own address and -r the directory it serves; both
are required. udedhcpd -B points clients at it and -b names the file
to load. Each request and each finished transfer is logged (-q turns
that off), and the counters are printed on exit.
A configuration file
-C / --configuration FILE, or UDE_CONFIG, reads the [udetftpd]
table of a TOML file; the command line
overrides it, and --check-config reports unknown keys. The keys are the
long options with _ for -: connection (--switch, which
[global] connection also sets), address, root (relative to the
file's directory), max_blksize, max_window, timeout, retries,
max_transfers and quiet. The same file can configure udedhcpd with
next_server and boot_file:
[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 = "/srv/tftp"
udedhcpd -C lab.toml &
udetftpd -C lab.toml &
What clients can ask for
- Block size (
blksize): up to 1468 bytes by default, which fills one Ethernet frame;-Blowers the limit. Without the option, blocks are 512 bytes. - Window (
windowsize, RFC 7440): several blocks per acknowledgment, up to 16 by default (-W, at most 64). - Timeout and transfer size (
timeout,tsize). Without a timeout from the client,udetftpdsends again after-tseconds (1) and gives up after-Rtries (5). - Modes: octet, and netascii (line ends become CR LF).
Files of any length up to 2 GiB work: the block number wraps from 65535
to 0. Up to -c transfers (64) run at once, each on its own port.
What it refuses
- Writes: a write request gets an access violation.
- Names with
.., a colon or control characters, and, on POSIX systems, names that lead out of the root through a symbolic link. Leading slashes are dropped and\counts as/. - Anything that is not a regular file.
TFTP has no passwords: every host on the switch can read every file in the root, so serve a directory of boot files, not a home directory.
C: box "client" "10.0.0.100" fit T: box "udetftpd" "10.0.0.2:69" fit at C + (3.2, 0) arrow from C.e + (0, 0.3) to T.w + (0, 0.3) "RRQ pxelinux.0, blksize 1432" above arrow from T.w + (0, 0.05) to C.e + (0, 0.05) "OACK, from a new port" above arrow from C.e + (0, -0.2) to T.w + (0, -0.2) "ACK 0" above arrow from T.w + (0, -0.45) to C.e + (0, -0.45) "DATA 1, 2, ... (a window)" below→ /pikchrshow