== cloud.nine.sh ==
Artur's tech notes

Quick start: virtual machines on OpenBSD

openbsd virtualisation

Since OpenBSD 5.9 it is possible to run virtual machines using a native virtualisation solution.

This is a short note/guide on how to set up a VM on OpenBSD in the simplest way that lets you have a quick play with vmm/vmd.


  1. First of all, we need to enable vmd on our host and get it running:

    # rcctl enable vmd
    # rcctl start vmd
  2. You may also want to make sure you firewall can initially let everything through:

    # Pass everything on the VM interface
    pass quick on tap0
    # NAT for the VM network
    pass out on egress from to any nat-to (egress)


  1. Let’s assume we store all of our VMs in /var/vm and openbsd will be the name of our experimental VM.

    # mkdir /var/vm/openbsd
    # cd /var/vm/openbsd
  2. To install OpenBSD inside of the VM we download the installation image (and store it in the same directory as the VM, which probably is not very clean):

    # wget https://cdn.openbsd.org/pub/OpenBSD/6.9/amd64/install69.iso
  3. Then, we create a virtual 10G disk:

    # vmctl create -s 10G openbsd.qcow2
  4. To start the VM and boot it from the installation image, we run the following command:

    # vmctl start -m 1G -L -i 1 -r install69.iso -d openbsd.qcow2 openbsd
  5. Connect to the console. This effectively finds the console for the openbsd VM and calls cu.

    # vmctl console openbsd

    To disconnect from the console you need to type in an escape sequence: ~. (or ~~. if you are connected via SSH).

Configuration of vmd

You can add your VM’s configuration to /etc/vm.conf:

vm "openbsd" {
    memory 1G
    disk /var/vm/openbsd/openbsd.qcow2
    local interface

This will allow you to skip all the additional switches to vmctl start that we used earlier.

Controlling the VM

To control your VM, you can use vmctl:

  • run vmctl status to check the status of all the VMs running in your system, or vmctl status openbsd to check the status of your VM,

  • vmctl start openbsd and vmctl stop openbsd start and stop your VM, respectively.