OpenBSD manual page server

Manual Page Search Parameters

VM.CONF(5) File Formats Manual VM.CONF(5)

vm.confvirtual machine configuration

vm.conf is the configuration file to configure the virtual machine monitor (VMM) subsystem. A VMM manages virtual machines (VMs) on a host. The VMM subsystem is responsible for creating, destroying, and executing VMs.

vm.conf is divided into four main sections:

User-defined variables may be defined and used later, simplifying the configuration file.
Global settings for vmd(8).
Configuration for each individual virtual machine.
Configuration for virtual switches.

Within the sections, the bytes argument can be specified with a human-readable scale, using the format described in scan_scaled(3).

The current line can be extended over multiple lines using a backslash (‘\’). Comments can be put anywhere in the file using a hash mark (‘#’), and extend to the end of the current line. Care should be taken when commenting out multi-line text: the comment is effective until the end of the entire block.

Argument names not beginning with a letter, digit, underscore, or slash must be quoted.

Additional configuration files can be included with the include keyword, for example:

include "/etc/vm1.example.com.conf"

Macros can be defined that will later be expanded in context. Macro names must start with a letter, digit, or underscore, and may contain any of those characters. Macro names may not be reserved words (for example, vm, memory, or disk). Macros are not expanded inside quotes.

For example:

ramdisk="/bsd.rd"
vm "vm1.example.com" {
	memory 512M
	boot $ramdisk
}

The following setting can be configured globally:

address/prefix
Set the network prefix that is used to allocate subnets for local interfaces, see local interface in the VM CONFIGURATION section below. The default is 100.64.0.0/10.

Each vm section starts with a declaration of the virtual machine name:

name {...}
The name can be any alphanumeric string along with '.', '-', and '_' characters. However, it cannot start with '.', '-', or '_'. Typically the name is a hostname.

Followed by a block of parameters that is enclosed in curly brackets:

path
Kernel or BIOS image to load when booting the VM. If not specified, the default is to boot using the BIOS image in /etc/firmware/vmm-bios.
path
ISO image file.
Automatically start the VM. This is the default if neither enable nor disable is specified.
Do not start this VM.
path
Disk image file (may be specified multiple times to add multiple disk images).
[local] interface [name] [{...}]
Network interface to add to the VM. The optional name can be either ‘tap’ to select the next available tap(4) interface on the VM host side (the default) or tapN to select a specific one.

Valid options are:

group-name
Assign the interface to a specific interface “group”. For example, this can be used to write pf.conf(5) rules for several VM interfaces in the same group. The group-name must not end with a digit.
[locked] lladdr [etheraddr]
Change the link layer address (MAC address) of the interface on the VM guest side. If not specified, a randomized address will be assigned by vmd(8). If the locked keyword is specified, vmd(8) will drop packets from the VM with altered source addresses.
rdomainid
Attach the interface to the routing domain with the specified rdomainid. If attaching to a switch that also has an rdomainid set, the rdomainid configured for the interface takes precedence.
name
Set the virtual switch by name. See the SWITCH CONFIGURATION section about virtual switches. This option is ignored if a switch with a matching name cannot be found.
Start the interface forwarding packets. This is the default.
Stop the interface from forwarding packets.

A local interface will auto-generate an IPv4 subnet for the interface, configure a gateway address on the VM host side, and run a simple DHCP/BOOTP server for the VM. This option can be used for layer 3 mode without configuring a switch.

count
Optional minimum number of network interfaces to add to the VM. If the count is greater than the number of interface statements, additional default interfaces will be added.
bytes
Memory size of the VM, in bytes, rounded to megabytes. The default is 512M.
user[:group]
Set the owner of the VM to the specified user or group. The owner will be allowed to start or stop the VM and open the VM's console.
:group
Set the owner to the specified group.

A virtual switch allows VMs to communicate with other network interfaces on the host system via either bridge(4) or switch(4). The network interface for each virtual switch defined in vm.conf is pre-configured using hostname.if(5) or ifconfig(8) (see the BRIDGE and SWITCH sections in ifconfig(8) accordingly). When a VM is started, virtual network interfaces which are assigned to a virtual switch have their tap(4) interface automatically added into the corresponding bridge(4) or switch(4) interface underlying the virtual switch.

Virtual switches can be configured at any point in the configuration file. Each switch section starts with a declaration of the virtual switch:

name {...}
This name can be any string, and is typically a network name.

Followed by a block of parameters that is enclosed in curly brackets:

Automatically configure the switch. This is the default if neither enable nor disable is specified.
If this option is specified, vmd(8) will drop packets with altered sources addresses that do not match the link layer addresses (MAC addresses) of the VM interfaces in this switch.
Do not configure this switch.
group-name
Assign each interface to a specific interface “group”. For example, this can be used to write pf.conf(5) rules for several VM interfaces in the same group. The group-name must not end with a digit.
name
Set the switch(4) or bridge(4) network interface of this switch. If the type is changed to switch0, it will be used for each following switch.
rdomainid
Set the routing domain of the switch and all of its VM interfaces to rdomainid.
Start the switch forwarding packets. This is the default.
Stop the switch from forwarding packets.

Create a new VM with 1GB memory, 1 network interface connected to “uplink”, with one disk image ‘/home/joe/vm2-disk.img’, owned by user ‘joe’:

vm "vm2.example.com" {
	memory 1G
	disk "/home/joe/vm2-disk.img"
	interface { switch "uplink" }
	owner joe
}

Create the switch "uplink" with an additional physical network interface:

switch "uplink" {
	interface bridge0
}

vmm(4), vmctl(8), vmd(8)

The vm.conf file format first appeared in OpenBSD 5.9.

Mike Larkin <mlarkin@openbsd.org> and Reyk Floeter <reyk@openbsd.org>.

January 3, 2018 OpenBSD-6.3