========================
== Artur's Tech Notes ==
========================
Artur's tech notes

Public VMs on OpenBSD

openbsd virtualisation

This is a note on how to make a VM running on OpenBSD connect to the host’s network.

Firstly, we need to create a bridge with our external network interface.

# echo "em0" > /etc/hostname.bridge0
# /etc/netstart bridge0

In /etc/vm.conf we need to add a switch on bridge0:

switch "sw" {
    interface bridge0
}

Then, our VM needs to be attached to that switch:

vm "openbsd" {
    memory 8G
    enable
    disk /data/vm/openbsd/main.qcow2
    interface tap {
	switch "sw"
    }
}

My network setup also requires to specify the MAC address of the network interface:

    interface tap {
	switch "sw"
	lladdr 00:11:22:33:44:55
    }

Finally, you need to configure your VM’s network to use an external interface’s IP address. It is probably a good idea to also configure a firewall on your VM (or on the host).