OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Synopsis
        • TFTP Use Cases
        • Run tftpd
        • Testing with tftp(1)
        • PXE Boot Example
        • Firewall Configuration
        • Logging
        • Security Considerations
        • TFTP Client (tftp(1))
        • Alternatives and Enhancements

        TFTP

        Synopsis #

        OpenBSD includes tftpd(8) and tftp(1) in base. TFTP transfers files over UDP without authentication or encryption. Use a restricted provisioning network.

        TFTP Use Cases #

        Typical uses include PXE boot and device firmware provisioning. For OpenBSD installation, see Automated Installation and PXE Boot .

        Run tftpd #

        OpenBSD runs tftpd as a standalone daemon. It chroots to its positional directory argument and drops privileges to _tftpd.

        doas install -d -o root -g wheel -m 755 /tftpboot
        doas rcctl enable tftpd
        doas rcctl set tftpd flags /tftpboot
        doas rcctl start tftpd
        

        Use rcctl restart tftpd after changing its flags. The -l address option restricts the listening address; it does not enable logging.

        Testing with tftp(1) #

        Place a readable file in the serving directory:

        doas cp /bsd.rd /tftpboot/bsd.rd
        doas chmod 644 /tftpboot/bsd.rd
        

        Then test from another directory or client:

        $ tftp localhost
        tftp> binary
        tftp> get bsd.rd
        tftp> quit
        

        Verify the downloaded file against the source. The server must be able to traverse directories and read the file after changing to _tftpd.

        PXE Boot Example #

        For a legacy BIOS OpenBSD amd64 client, place the matching release’s pxeboot and bsd.rd in /tftpboot. Merge the following into an appropriate DHCP subnet configuration:

        next-server 192.0.2.1;
        filename "pxeboot";
        

        UEFI clients need the matching EFI bootloader and architecture-specific DHCP selection; see the complete PXE guide.

        Firewall Configuration #

        Permit requests only from the provisioning network. Merge these rules into the site’s policy, replacing em1 and the subnet:

        pass in on em1 inet proto udp from 192.0.2.0/24 to (em1) port 69
        pass out on em1 inet proto udp from (em1) to 192.0.2.0/24
        

        UDP port 69 handles the initial request. Transfers use a server-selected UDP port, so a port-69-only policy is insufficient. The outbound rule allows those responses and their stateful replies; constrain the network to trusted provisioning clients.

        Logging #

        Enable verbose logging with -v:

        doas rcctl set tftpd flags -v /tftpboot
        doas rcctl restart tftpd
        doas tail -f /var/log/daemon
        

        Security Considerations #

        Keep the serving directory root-owned and files read-only unless uploads are needed. The chroot is automatic. The -w option permits writes to existing publicly writable files; -c additionally permits creating files, subject to directory permissions:

        doas rcctl set tftpd flags -v -w /tftpboot
        

        Do not enable it for a download-only boot server. Existing writable files can be overwritten; check ownership and modes as well as daemon flags.

        TFTP Client (tftp(1)) #

        Use binary mode for bootloaders and firmware:

        $ tftp server.example
        tftp> binary
        tftp> get firmware.img
        tftp> quit
        

        For scripted transfers, feed commands to tftp on standard input and verify the resulting file; a successful connection does not mean the file was transferred.

        Alternatives and Enhancements #

        Use HTTPS where supported by the boot or provisioning client. For authenticated file transfers, use SFTP or rsync over SSH.

        Report a bug
        • Synopsis
        • TFTP Use Cases
        • Run tftpd
        • Testing with tftp(1)
        • PXE Boot Example
        • Firewall Configuration
        • Logging
        • Security Considerations
        • TFTP Client (tftp(1))
        • Alternatives and Enhancements