.Dd Created:2025-10-03|Updated:2025-10-15| .de ocsi \\$* , .. .de oxr .ocsi .Xr \\$* .. .de oit .It \\$* .. .de obdi .Bl -dash -compact .oit \\$* .. .de obdl .Bd -literal -compact \\$* .. .de onote .Bl -hang -compact .oit \\$* .El .. .de ocomm .Bl -diag -compact .oit \\$* .El .. .de opsy .Pp .Sy - \\$* .. .de obc .Bl -column \\$* .. .de obc2 .obc opt desc .. .de obc3 .obc option arguments description .. .Dt VM oh .Os OpenBSD 7.7| .Nm vm .Nd configuration, usage and tips .Sh TLDR .obdl 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 .Ed .Sh TOC .Bl -column -offset indent ".Sy PORT FORWARDING " .It Sx WORKING OS Ta : OpenBSD, centos, archlinux, opensuse. .It Sx SERIAL CONSOLE .It Sx INTERNET ACCESS Ta : Pa vmd.conf .It Sx PORT FORWARDING Ta : Using pf. .It Sx TODO .It Sx SEE ALSO .El .Sh WORKING OS OpenBSD, centos, archlinux, opensuse. .Sh SERIAL CONSOLE Some linux distributions may not have the serial console enabled by default, the following is an example for Slackware lilo. .Bl -enum -compact .oit On the boot loader press tab. .oit type: .Dl huge.s serial 0 115200, console=ttyS0,115200 .oit to disconnect from the console but keep the vm running: [ENTER] ~^d .El .ocomm This has been tested on slackware, centos, archlinux, opensuse. .Sh INTERNET ACCESS .Ss host .Bl -enum -compact .oit allow forwarding. .Dl sysctl net.inet.ip.forwarding=1 .oit vm.conf: .obdl vm "vm_name" { ... local interface } .Ed .oit pf.conf : this provides the vm with a dns. .obdl 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 .Ed .oit reload pf.conf: after this the vm will have internet access. .Dl pfctl -f /etc/pf.conf .El .Sh PORT FORWARDING The vm can be accessed through ssh from the host using the local interface: .Dl ssh 100.64.1.3 For external access, follow these steps: .Bl -enum -compact .oit allow external access (pc other than the host) using pf. .Dl pass in on egress proto tcp from any to any port [EXTERNAL_PORT] rdr-to [VM_IP] port [VM_PORT] .It reload pf.conf: after this the vm will be accessible by other machines in the network. .Dl pfctl -f /etc/pf.conf .El .Ss example .Bl -column ".Sy example " .It example Ta : ssh .It host ip Ta : 192.168.1.10 .It guest Ta : 100.64.1.3 .El .obdi pf.conf (on the host): .Dl pass in on egress proto tcp from any to any port 10122 rdr-to 100.64.1.3 port 22 .It Reload pf.conf: .Dl pfctl -f /etc/pf.conf .oit ssh command: .Dl ssh -p 10122 192.168.1.10 .El .Sh TODO .obdi test and document real host in the network. .oit slackware: unable to load virtio, it doesn't detect vda. This was an issue at some point, needs to be re-tested. .oit Verify parameters for other linux distributions. .oit Add permanent kernel parameters. .oit create vm to follow OpenBSD current upon 7.8 release. .El .Sh SEE ALSO .oxr pf oh .Xr openbsd oh .opsy OpenBSD manpages: .oxr vmctl 8 .oxr vm.conf 5 .oxr vmd 8 .oxr rcctl 8 .oxr pfctl 8 .Xr pf.conf 5 .El .Ss links .obc2 .It - Lk https://www.openbsd.org/faq/faq16.html OpenBSD FAQ - Virtualization .It - Lk https://www.tumfatig.net/2019/running-arch-linux-using-openbsd-vmd8/ TuM'Fatig - Running Arch Linux using OpenBSD vmd(8) .El .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com