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
          • Run FreeBSD on OpenBSD with vmd
          • 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
          • Run Sway 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 Handbook Style Guide
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Overview
        • Directory Layout
        • Disk and Image Creation
        • Single OpenBSD VM (Interactive Install)
        • Networking Options
          • Example: Two VMs on Private NAT Network
          • Example: Bridge VMs to Physical LAN
        • Non-OpenBSD Guests
          • FreeBSD
          • Linux (Debian Example)
          • Windows (Unsupported Guest)
        • VM Management
        • Troubleshooting

        Virtualization Cheat Sheet

        Overview #

        OpenBSD’s native hypervisor stack includes:

        • vmm(4) : Kernel hypervisor.
        • vmd(8) : Virtual machine daemon.
        • vmctl(8) : Command-line control utility.

        For detailed guidance, see the Handbook’s Virtualization chapter .

        Directory Layout #

        This example uses /var/vmm/ for VM assets; choose a private location with sufficient space. Create its images and iso subdirectories with root ownership before use.

        PurposePathNotes
        Disk images/var/vmm/images/<name>.imgSparse raw files created by vmctl.
        Installer ISOs/var/vmm/iso/<file>.isoStore verified installer images for supported guests.
        Configuration files/var/vmm/conf/Optional: store install.conf, kickstart, etc.
        Logs (host)/var/log/daemonvmd(8) logs for troubleshooting.

        Disk and Image Creation #

        TaskCommandNotes
        Create 10G sparse disk imagedoas vmctl create -s 10G /var/vmm/images/obsd.imgGrows on write up to specified size.
        Download OpenBSD ISOdoas ftp -o /var/vmm/iso/install80.iso https://cdn.openbsd.org/pub/OpenBSD/8.0/amd64/install80.isoUse ftp(1) or similar tool.

        Before starting guests, enable and start vmd with rcctl. Verify downloaded installation media using the release SHA256.sig and matching signify key as described in Installing OpenBSD .

        Single OpenBSD VM (Interactive Install) #

        doas vmctl create -s 10G /var/vmm/images/obsd.img
        doas vmctl start -c -m 1G -r /var/vmm/iso/install80.iso -d /var/vmm/images/obsd.img obsd
        
        • -c: Connect to console.
        • -m: Memory (1G = 1024M).
        • -r: ISO for installation.
        • -d: Disk image.
        • Last argument: VM name.

        After installation, reboot without ISO:

        doas vmctl stop -w obsd
        doas vmctl start -c -m 1G -d /var/vmm/images/obsd.img obsd
        

        Networking Options #

        vmctl start -n name attaches to an existing named switch. It does not interpret local or tap0 as special network modes. The -L option creates local networking; Internet access still requires host forwarding and PF policy.

        Example: Two VMs on Private NAT Network #

        Use the complete Virtualization procedure to configure local networking, forwarding, and NAT before starting guests with -L. Creating a disk does not install an operating system in it.

        Example: Bridge VMs to Physical LAN #

        Create /etc/hostname.bridge0, replacing em1 with the intended LAN interface:

        add em1
        up
        

        Define the switch in /etc/vm.conf:

        switch "lan" {
            interface bridge0
        }
        

        Activate it and start an already installed guest:

        doas sh /etc/netstart bridge0
        doas rcctl enable vmd
        doas rcctl start vmd
        doas vmctl reload
        doas vmctl start -c -m 1G -d /var/vmm/images/obsd.img -n lan obsd
        

        The guest obtains addressing from the LAN or uses a matching static configuration. To expose a single VLAN, create a vlanN interface with parent and vnetid settings and bridge that interface. vether0.<vlan> is not OpenBSD interface syntax.

        Non-OpenBSD Guests #

        FreeBSD #

        The official virtualization FAQ documents OpenBSD and Linux guests. Use a hypervisor with documented FreeBSD support when running FreeBSD.

        Linux (Debian Example) #

        Use media with serial-console support and a kernel supporting the provided virtual devices. Follow the current guest-specific installer instructions in the official virtualization FAQ and verify the image’s signature before booting it.

        Windows (Unsupported Guest) #

        vmm/vmd does not provide a supported Windows desktop guest procedure or graphical console. Use a host or hypervisor with documented Windows support.

        VM Management #

        ActionCommand
        List VMsdoas vmctl status
        Connect to consoledoas vmctl console <name>
        Graceful shutdownGuest: halt or OS-specific
        Force stopdoas vmctl stop -f <name>
        Pause/resumedoas vmctl pause <name> / doas vmctl unpause <name>

        For non-root access, configure doas(1) using the administrator-account guide .

        Troubleshooting #

        • Check vmd logs: tail -f /var/log/daemon.
        • Verify network interfaces: ifconfig -a.
        • Confirm paths: /var/vmm/images/, /var/vmm/iso/.
        • Check pf(4) rules for custom networking issues.
        Report a bug
        • Overview
        • Directory Layout
        • Disk and Image Creation
        • Single OpenBSD VM (Interactive Install)
        • Networking Options
          • Example: Two VMs on Private NAT Network
          • Example: Bridge VMs to Physical LAN
        • Non-OpenBSD Guests
          • FreeBSD
          • Linux (Debian Example)
          • Windows (Unsupported Guest)
        • VM Management
        • Troubleshooting