OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction
      • Installing OpenBSD
      • The X Window System
      • Networking
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • Graphical 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
          • smtpd
          • Dovecot
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound
          • NSD
          • BIND
        • Networking
          • OpenBGPD
          • rad
          • DHCP
          • slaacd
        • Web
          • Apache
          • nginx
          • httpd
          • relayd
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • sshd
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ
        • Time
          • NTP
      • 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
        • Complete the First 30 Minutes After Installation
        • Check Hardware Compatibility Before Installing
        • Bootstrap Wi-Fi Firmware Without Ethernet
        • Set Up OpenBSD as a Laptop or Workstation
        • Configure Laptop Power Management
        • Run OpenBSD as a Virtual Machine Guest
        • Install OpenBSD on a VPS or Cloud Server
        • Install OpenBSD with Full-Disk Encryption
        • Troubleshoot Web Browsers on OpenBSD
        • Create an Administrator Account with doas and SSH Keys
        • Establish a Conservative Security Baseline
        • Manage OpenBSD with Ansible
        • Recover Access and Reset the Root Password
        • Collect OpenBSD Diagnostic Evidence
        • Configure Secure Remote Access with OpenSSH
        • Set Up WordPress
        • Build Third-Party Software from Ports
        • Use FIDO Security Keys with OpenSSH
        • Build OpenBSD from Source
        • Configure Wi-Fi Roaming and Wired Failover
        • Dual-Boot OpenBSD on a UEFI System
        • Troubleshoot PF, NAT, and Routing
        • Automate OpenBSD Installation with Autoinstall and PXE
        • Route Multiple VLANs with PF
        • Configure a Road-Warrior WireGuard VPN
        • Troubleshoot Package Installation and Update Failures
        • Route IPv6 Networks without NAT
        • Schedule Recurring Maintenance
        • Plan a Docker Workload Migration to OpenBSD
        • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Build a Simple Router and Firewall
        • Monitor an OpenBSD System
        • Back Up and Restore an OpenBSD System
        • Configure softraid RAID1
        • Recover an OpenBSD System That Does Not Boot
        • Install Z shell (zsh)
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • 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 official ISOs (OpenBSD, FreeBSD, etc.).
      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 https://cdn.openbsd.org/pub/OpenBSD/7.9/amd64/install79.iso -o /var/vmm/iso/install79.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/install79.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 #

      Do not assume compatibility from a generic amd64 ISO. The official virtualization FAQ documents OpenBSD and Linux guests; this handbook does not provide a verified FreeBSD installation procedure.

      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) .

      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