_                    _
  ___ | |__   __ _ _______ | |_
 / _ \| '_ \ / _` |_  / _ \| __|
| (_) | | | | (_| |/ / (_) | |_
 \___/|_| |_|\__,_/___\___/ \__|

vmconfiguration, usage and tips

vmctl create -s 50G disk.qcow2
vmctl start -m 1G -i 1 -b /bsd -d disk.qcow2 myvm
vmctl show #will show mywm
vmctl console myvm
vmctl stop myvm

back to top

WORKING OS : OpenBSD, centos, archlinux, opensuse.
SERIAL CONSOLE
INTERNET ACCESS : vmd.conf
PORT FORWARDING : Using pf.
TODO
SEE ALSO

OpenBSD, centos, archlinux, opensuse.

back to top

Some linux distributions may not have the serial console enabled by default, the following is an example for Slackware lilo.

  1. On the boot loader press tab.
  2. type:
    huge.s serial 0 115200, console=ttyS0,115200
  3. to disconnect from the console but keep the vm running: [ENTER] ~^d
This has been tested on slackware, centos, archlinux, opensuse.

back to top

  1. allow forwarding.
    sysctl net.inet.ip.forwarding=1
  2. vm.conf:
    vm vm_name {
    	...
    	local interface
    }
  3. pf.conf : this provides the vm with a dns.
    match out on egress from 100.64.0.0/10 to any nat-to (egress)
    pass in proto { udp tcp } from 100.64.0.0/10 to any port domain rdr-to 192.168.1.1 port domain
  4. reload pf.conf: after this the vm will have internet access.
    pfctl -f /etc/pf.conf

back to top

The vm can be accessed through ssh from the host using the local interface:

ssh 100.64.1.3
For external access, follow these steps:
  1. allow external access (pc other than the host) using pf.
    pass in on egress proto tcp from any to any port [EXTERNAL_PORT] rdr-to [VM_IP] port [VM_PORT]
  2. reload pf.conf: after this the vm will be accessible by other machines in the network.
    pfctl -f /etc/pf.conf

example : ssh
host ip : 192.168.1.10
guest : 100.64.1.3
  • pf.conf (on the host):
    pass in on egress proto tcp from any to any port 10122 rdr-to 100.64.1.3 port 22
  • Reload pf.conf:
    pfctl -f /etc/pf.conf
  • ssh command:
    ssh -p 10122 192.168.1.10

back to top

back to top

pf , openbsd

- OpenBSD manpages: vmctl(8) , vm.conf(5) , vmd(8) , rcctl(8) , pfctl(8) , pf.conf(5)

- OpenBSD FAQ - Virtualization
- TuM'Fatig - Running Arch Linux using OpenBSD vmd(8)

back to top

ohazot | about | ohazot.com <admin@ohazot.com>

OpenBSD 7.7| Created:2025-10-03|Updated:2025-10-15|