OpenBSD Virtual Machines - Beginner Guide

Contents
OpenBSD Virtual Machines - Beginner Guide
Step 1: Install vmd (OpenBSD VM Daemon)
Step 2: Create a Virtual Machine
Step 3: Start the Virtual Machine
Step 4: Manage the VM
Step 5: Networking for VMs

OpenBSD Virtual Machines - Beginner Guide

Running OpenBSD as a virtual machine is great for testing, learning, or running services isolated from your main system. Here's how.

Step 1: Install vmd (OpenBSD VM Daemon)

OpenBSD includes a built-in virtual machine system called vmd.

pkg_add vmd - installs the virtual machine daemon

After installation: Start the vmd service:
rcctl enable vmd - start vmd on boot
rcctl start vmd - start vmd immediately

Step 2: Create a Virtual Machine

Create a VM configuration file:
vmctl create name=testvm

This creates:
/etc/vmd/testvm.conf - VM configuration file
/var/vmd/testvm.disk0 - virtual disk image

View the configuration:
cat /etc/vmd/testvm.conf

Typical configuration looks like:

machtype "openbsd-74"
disk0 " /var/vmd/testvm.disk0" {
    size 10G  # 10 GB virtual disk
}
nmd0 "opt_nmd0" {
    # Network configuration
}

Step 3: Start the Virtual Machine

vmctl start testvm - start your VM

What happens: The VM boots, and you'll see a console appear.

To connect to the VM console:
vmctl console testvm - opens the VM console interface

Alternatively, use SSH: If you set up networking in the VM config, you can SSH into the VM.

Step 4: Manage the VM

List your VMs:
vmctl list - shows all defined VMs and their status

Stop a VM:
vmctl stop testvm - gracefully stop the VM

Delete a VM:
vmctl destroy testvm - permanently delete the VM and its disk

Important: destroy removes the virtual disk file cannot be undone!

Resize the disk: Edit the configuration file and change the size, then use
vmctl stop testvm before resizing, or the changes may not take effect properly.

Step 5: Networking for VMs

By default, VMs can communicate with the host and each other.

Bridge networking: Connect the VM to your physical network interface.

In /etc/vmd.conf or per-VM config:
nmd0 "opt_nmd0" { } - enables network interface

Host-only networking: VM can only communicate with the host, not the external network.

Common use cases:
- Testing: Try OpenBSD or other OSes without affecting your main system
- Learning: Experiment with configuration changes safely
- Servers: Run development servers isolated from production

Advanced virtualization topics? Proceed to Lesson 81: Virtual Machines.

Next: OpenBSD Course Conclusion - Beginner Guide

Article author: Arthur Isaev

Related articles
UNIX
OpenBSD
OpenBSD course
Architecture Compatibility
Prepare Installation Media
BIOS Installation
UEFI Installation
Disk Partitioning
Base System Installation
Configure Network
Disable Firewall Temporarily
OpenSSH Server
Update System
Security Basics
Frequently Asked Questions
Virtualization Overview
Docker Containers
Kubernetes
PF NAT Configuration
PF Suppression
IPsec VPN
WireGuard VPN
Advanced Cron
Systemd Compatibility
PF Firewall Introduction
Shells
Environment Variables
Sudoers Configuration
/etc/fstab
Group Management
Password Security
Issue and Banner
PAM Configuration
TCP Wrappers
Intrusion Detection
PF Advanced Rules
Log Analysis
Advanced Backup
Kernel Update
Certificate Management
Access Control Lists (ACLs)
User Security Settings
Vulnerability Management
Security Audit Tools
Security Parameter Tuning
SSH Key Authentication
sudo vs doas
Users and Groups
PostgreSQL Introduction
Services Management
Web Server Overview
Install Apache Web Server
Install Nginx Web Server
Database Setup
Install PHP
Firewall Configuration
SSL/TLS Certificate
Firewall Configuration
Install PHP
Install PHP
Advanced SSL/TLS Configuration
User Management Advanced
PF Logging and Monitoring
Custom Kernel compilation
Advanced doas Configuration
Resource Limits
DHCP Server
Mail Server
SSH Hardening
System Logging
Disk Encryption
Window Managers
Text Editors
Package Management
Cron Jobs
System Monitoring
PF Firewall Advanced
SSH Configuration
Services Management
PHP and Web Stack
Advanced User Management
Swap and Memory
Kernel Parameters
Boot Process
Mounting Filesystems
UFS Filesystem
Softraid
Disk Management
DNS Configuration
Hosts File
Network Statistics
Routing
Network Bridging
System Upgrade
Backup Strategies
Log Rotation
GCC Compiler
Make Build System
Debugging
System Call Tracing
FIPS 140-2
Audit System
Security Compliance
Virtual Machines
LXC Containers
HTTP API
Advanced Monitoring
SELinux (Ported)
Course Conclusion
OpenBSD Architecture - Beginner Guide
OpenBSD Installation Media - Beginner Guide
OpenBSD Disk Partitioning - Beginner Guide
OpenBSD System Updates - Beginner Guide
OpenBSD PF Firewall - Beginner Guide
OpenBSD SSH Configuration - Beginner Guide
OpenBSD User Management - Beginner Guide
OpenBSD Web Server - Beginner Guide
OpenBSD PostgreSQL Database - Beginner Guide
OpenBSD PF Logging and Monitoring - Beginner Guide
OpenBSD SSH Hardening - Beginner Guide
OpenBSD Package Management - Beginner Guide
OpenBSD Firewall Configuration - Beginner Guide
OpenBSD Backup Strategies - Beginner Guide
OpenBSD GCC Compiler - Beginner Guide
OpenBSD Virtual Machines - Beginner Guide
OpenBSD Course Conclusion - Beginner Guide

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.com
Write to info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: