| VM.CONF(5) | File Formats Manual | VM.CONF(5) |
vm.conf — virtual
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 the following main
sections:
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:
agentx
[context context]
[path path]local
prefix
address/prefixlocal interface in the
VM CONFIGURATION section below.
The default is 100.64.0.0/10.local
inet6 [prefix
address/prefix]socket
owner user:groupstaggered
start parallel parallelism
delay secondsEach vm section starts with a declaration
of the virtual machine name:
vm
name {...}Followed by a block of parameters that is enclosed in curly brackets:
allow
instance {...}boot
pathboot device devicecdromcdrom parameter.diskdisk parameter.netboot
parameter as if the VM was network booted. In addition, the DHCP lease
will advertise “auto_install” in the bootfile option
making it suitable for use with
autoinstall(8). Note,
this is not to be confused with
pxeboot(8) but rather a
simulated network boot.Currently disk and
cdrom only work with VMs booted using BIOS.
cdrom
pathenableenable nor disable is
specified.disabledisk
path [format
fmt]qcow2 (a sparse file format which reduces storage)
or raw. If left unspecified, the format defaults
to raw if it cannot be derived automatically.local] interface
[name] [{...}]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
group-namelocked] lladdr
[etheraddr]locked keyword is specified,
vmd(8) will drop packets from
the VM with altered source addresses.rdomain
rdomainidswitch
nameupdownA 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.
If the global local inet6 option is
enabled, a routable IPv6 gateway address will be generated on the host
side. Unlike the IPv4 option,
vmd(8) does not respond to
DHCPv6 or router solicitation messages itself. Use
rad(8) listening on the
interface group, e.g. interface
tap for auto-configuring the VMs
accordingly.
interfaces
countinterface statements, additional default
interfaces will be added.memory
bytesowner
user:groupsevIt is possible to use configured or running VMs as a template for
additional instances of the VM. An instance is just like a normal
vm and is configured with the following declaration
of the virtual machine name:
vm
parent instance
name {...}The new instance will inherit settings from the VM
parent, except for exclusive options such as
disk, interface lladdr, or
interface name. The
configuration options are identical to the
VM CONFIGURATION, but restricted
to the allowed instance options.
The allowed instance options are configured in the parent VM:
allow
instance {...}Valid options are:
bootcdromdiskinstanceinterfacememoryowner
user[:group]owner
:groupA virtual switch allows VMs to communicate with other network
interfaces on the host system via either
bridge(4) or
veb(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
VEB 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 veb(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:
switch
name {...}Followed by a block of parameters that is enclosed in curly brackets:
enableenable nor disable is
specified.locked
lladdrdisablegroup
group-nameinterface
namerdomain
rdomainidupdownCreate 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 a new VM as an instance from ‘vm2.example.com’:
vm "vm2.example.com" instance "vm3.example.com" {
disk "/home/joe/vm3-disk.img"
}
Create the switch "uplink" with an additional physical network interface:
switch "uplink" {
interface bridge0
}
The vm.conf file format first appeared in
OpenBSD 5.9.
Mike Larkin <mlarkin@openbsd.org> and Reyk Floeter <reyk@openbsd.org>.
Each guest requires one tap(4) device per assigned interface and one pty(4) device. Administrators may need to create additional devices using MAKEDEV(8).
| September 16, 2024 | openbsd |