Running virtualization on OpenBSD: getting to know the type 1 hypervisor vmm(4) and the vmd(8) daemon, managing VMs with vmctl, installing and running OpenBSD or Linux VMs, building tap-based networking, and using snapshots for safe testing.

In episode 17 you ran a mail server with OpenSMTPD. Now we return to the foundation of your lab from episode 0 — except this time, you're the hypervisor. OpenBSD brings virtualization directly into the base system: vmm as the type 1 hypervisor and vmd as its managing daemon.
Imagine: everything you've learned in this series can be tested on top of OpenBSD itself. You can run a second OpenBSD as a client, back it up, snapshot it, destroy it, and start again — without any extra machine. This is why vmm is a favorite for labs and testing.
OpenBSD's virtualization consists of two parts:
The type 1 nature means the hypervisor runs directly on the hardware, without a host OS in between. It's efficient and — in OpenBSD style — its code surface is far smaller than the big hypervisors.
First check whether your hardware supports virtualization:
dmesg | grep -i vmm
sysctl hw.vmmIf VMX/SVM is supported, enable the services:
rcctl enable vmm
rcctl start vmm
rcctl enable vmd
rcctl start vmdvmm and vmd are two separate services; both need to be active.
Warning
vmm requires hardware virtualization support (Intel VT-x or AMD-V). In a nested VM (nested virtualization), enable VT-x passthrough in the host hypervisor. If dmesg doesn't show vmm, check the BIOS/host settings first.
vmctl is the main tool. Some basic operations:
vmctl show
vmctl start vm1 -m 512M -d /vm/obsd.img -L
vmctl stop vm1
vmctl console vm1vmctl show lists the running VMs.vmctl start runs a VM with specified memory and disk; -L connects to the console.vmctl stop stops a VM.vmctl console connects to a VM's console.A VM disk is an image file on the host. Create it with vmctl create:
mkdir -p /vm
vmctl create /vm/obsd.img -s 10G
ls -la /vmA 10 GB image is ready to use. To install from an ISO, attach the ISO to the CD-ROM interface:
vmctl start vm1 -m 1G -d /vm/obsd.img -c /tmp/install74.iso -LThe VM boots from the ISO, and you go through an OpenBSD installation like in episode 3 — but now inside a VM. After the installation finishes, run it without the ISO.
For VMs to communicate, connect them via a tap interface. For a VM connected to a bridge with the host:
add bridge0 upThen attach the interface at start time:
vmctl start vm1 -m 1G -d /vm/obsd.img -i 1 -LThe VM gets a network interface connected to the same bridge as the host — the same pattern you know from episode 8. Other VMs can join the same bridge and communicate with each other.
vmm isn't only for OpenBSD — it also runs Linux and NetBSD. The key is using the right kernel. Many distributions provide a bzImage kernel that can be run directly:
vmctl start linux -m 1G -b bzImage -d /vm/linux.img -i 1 -L-b specifies the bzImage kernel. Great for quickly testing Linux on top of OpenBSD — useful when comparing ecosystems (episode 22).
One of the most useful features for a lab is snapshots — saving and restoring a VM's state:
vmctl stop vm1
vmctl snapshot vm1 /vm/vm1.before-pf.snap
vmctl start vm1 -r /vm/vm1.before-pf.snap -d /vm/obsd.imgvmctl snapshot saves a VM's memory state.vmctl start -r restores from a snapshot.This pattern is ideal for episodes 12-16: experiment with pf or relayd, and if you break something, revert to a clean snapshot in seconds.
Info
A snapshot saves memory state, not a disk copy. For truly complete recovery (memory + disk), combine snapshots with disk image backups (episode 11) — for example rsync the image to another machine.
Check VM resource consumption:
vmctl show
ps aux | grep vmd
vmctl stop -avmctl show displays the status, memory, and uptime of each VM. vmctl stop -a stops all VMs — useful when the lab needs to be clean. For more granular resource settings, check the vm.conf(5) man page for stored VM configurations.
In episode 18 you ran virtualization on OpenBSD: getting to know vmm(4) and vmd(8), managing VMs with vmctl, installing and running OpenBSD and Linux VMs, building tap- and bridge-based networking, and using snapshots for safe testing.
Key takeaways:
vmctl controls them.vmctl create.In the next episode, episode 19, we'll optimize performance & system optimization — tuning sysctl, using loader.conf, monitoring with systat, top, and netstat, and adjusting buffers and pf performance.