the virtual machine daemon
utility is used to control 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
Within the commands, the size
argument can be
specified with a human-readable scale, using the format described in
argument can be either a numeric, non-zero
identifier or alternatively the name of a virtual machine.
The commands are as follows:
- Using cu(1)
connect to the console of the VM with the specified
- Creates a VM disk image file with the specified
size, rounded to megabytes.
- Load additional configuration from the specified file.
- Disable verbose debug logging.
- Enable verbose debug logging.
- Pause a VM with the specified
- Receive a VM from standard input and start it with the
- Remove all stopped VMs and reload the configuration from
the default configuration file.
- Reset the running state.
- Reset the configured switches.
- Reset and terminate all VMs.
- Send a VM with the specified
id to standard output and terminate
- Starts a VM defined by the specified name and parameters:
Note that the VM name supplied to the 'start' command can only consist of
alphanumeric characters, including '.', '-', and '_'. The name cannot
start with '.', '-' or '_'.
- Boot the VM with the specified kernel or BIOS image. If
not specified, the default is to boot using the BIOS image in
- Automatically connect to the VM console.
- Disk image file (may be specified multiple times to add
multiple disk images).
- Number of network interfaces to add to the VM.
- Add a local network interface.
vmd(8) 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. See
below for more information on how addresses are calculated and
assigned when using the -L option.
- Memory size of the VM,
rounded to megabytes. The default is 512M.
- Add a network interface that is attached to the
specified virtual switch. See
vm.conf(5) for more
- ISO image file for virtual CD-ROM. This image file will
be available in the selected VM as a SCSI CD-ROM device attached to a
virtio SCSI adapter (e.g.
- Lists VMs running on the host, optionally listing just the
selected VM id.
- Stops (terminates) a VM defined by the specified VM
id. A graceful shutdown will be attempted
if the VM supports the
vmmci(4) device. Once
stopped, if the VM was not defined in a configuration file, then it is
- Unpause (resume from a paused state) a VM with the
If the -i
option is specified during VM startup, a
corresponding number of host-side
interfaces will be allocated
and mapped to the vio(4)
inside the guest VM. This tap/vio interface mapping allows guest network
traffic to be manipulated by the host. Any valid host-side interface
configuration may be performed on these tap interfaces, such as bridging (via
), or using
nat-to rules to create private
or host-side NATed networks, as desired.
Local interfaces can be used to easily configure VM networking without needing
to manually assign network addresses. A local interface is added to a VM using
the -L option to the 'vmctl start' command and results in the addition of a
interface inside the VM and
a corresponding tap(4)
the host. When using local interfaces,
will provide DHCP services
to the guest VM and offer addresses selected from the 100.64.0.0/10 IPv4
range. From within the 100.64.0.0/10 range,
allocates a pair of
addresses for the guest-side vio(4)
and host-side tap(4)
For the first local interface:
- The host (tapX) address is assigned 100.64.n.2, where
'n' is the numeric VM ID visible in the 'vmctl status' command
- The guest (vio0) address is assigned 100.64.n.3
For the second and subsequent local interface(s):
- The second local interface uses 100.64.n.4 and
100.64.n.5 for the host (tapX) and guest (vio1) interfaces,
- Subsequent local interfaces are numbered similarly,
continuing with 100.64.n.6 and 100.64.n.7, etc
Multiple -L options can be provided to the 'vmctl start' command, if more than
one interface is desired. Local interfaces are assigned to the VM before any
other interfaces specified with the -i option (thus, local interfaces, if
requested, are numbered starting at vio0 inside the guest VM).
When using local interfaces, the DHCP configuration offered to the guest VM
specifies the address of the corresponding host
interface as both the
default route and the (sole) nameserver. Guest VM traffic can optionally be
NATed through the host with an entry in the host machine's
similar to the following (if
pass out on $ext_if from 100.64.0.0/10 to any nat-to $ext_if
If NATing is desired, the net.inet.ip.forwarding sysctl must also be set to 1.
If desired, DNS queries originating from Guest VMs can be redirected to a
different DNS server with an entry in the host machine's
similar to the following:
pass in proto udp from 100.64.0.0/10 to any port domain \
rdr-to $dns_server port domain
- Default configuration file.
- UNIX-domain socket used for
communication with vmd(8).
utility exits 0 on success,
and >0 if an error occurs. vmctl
fail due to one of the following reasons:
- The VMM subsystem could not be enabled or disabled as
- A requested VM-based operation could not be
Create a 4.5 Gigabyte disk image, disk.img:
$ vmctl create disk.img -s 4.5G
Create a new VM with 1GB memory, one network interface, one disk image
('disk.img') and boot from kernel '/bsd':
# vmctl start "myvm" -m 1G -i 1 -b /bsd -d disk.img
will create a new
network interface on the
host side and set the description to indicate the VM by ID, interface number,
# ifconfig tap0
tap0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
index 15 priority 0 llprio 3
Terminate VM number 1:
command first appeared in
and Reyk Floeter