How to virtualize OpenBSD ?

Actually, everything is already well documented on OpenBSD's website. This chapter will just focus on a few tips.

You should definitely read OpenBSD's FAQ on this topic 😉.

Use other installation media

To use img disk (installXX.img or minirootXX.img) :

# vmctl start -c -m 1G -L -i 1 -d installXX.img -d /var/vm/obsdvm.qcow2 openbsdvm

Or if you don't want to download any file, you still can use the bsd.rd you rprobably already have :

# vmctl start -c -m 1G -L -i 1 -b /bsd.rd -d /var/vm/obsdvm.qcow2 openbsdvm 

However, such install requires to have configured a network access for clients.

In /etc/pf.conf :

# using quad9 DNS
pass in quick proto { tcp udp } from 100.64.0.0/10 to any port domain \
    rdr-to 9.9.9.9 port domain
match out on egress from 100.64.0.0/10 to any nat-to (egress)

Better if you have configured unwind on host, which is an excellent idea 😎 :

pass in proto { tcp udp } from 100.64.0.0/10 to any port domain \
    rdr-to localhost port domain
match out on egress from 100.64.0.0/10 to any nat-to (egress)

In "/etc/sysctl.conf" :

net.inet.ip.forwarding=1
net.inet6.ip6.forwarding=1