Virtual machine instances

To obtain a list of virtual machine instances registered with a VirtualBox host –

VBoxManage list vms

Individual virtual machine instances

To obtain configuration and status information relating to a specific virtual machine instance registered with a VirtualBox host –

VBoxManage showvminfo <virtualbox_instance>

<virtualbox_instance> refers to the name or UUID associated with a specific virtual machine instances reported using the "VBoxManage list vms" command.

When installing a new guest operating system under VirtualBox, the network mode for the guest defaults to "network address translation" ("NAT"). NAT involves the VirtualBox host operating as a stateful packet router that (i) accepts packets from the guest, extracts the TCP/IP data and resends it using the host operating system; and (ii) receives packets destined for the guest, repacks the TCP/IP data and transmits the resultant packet to the guest through the emulated driver operating on the guest platform. NAT works with internet protocol ("IP") packets; it therefore operates at OSI network layer ("L3").

Certain guests or applications rely on establishing connectivity between peers on the same logical or physical network at OSI data link layer ("L2"); for example, where peers connect to each other using a form of discovery protocol that operates by exchanging media access control ("MAC") addresses. In this case, it is necessary for the emulated driver serving the VirtualBox guest to have access to a physical or virtual network adapter indirectly through the VirtualBox host.

To enable a VirtualBox guest to operate at L2 the network mode for the guest must be set to "bridged" with the object of making the guest platform appear to be directly connected to the underlying network. To update a guest platform to use a bridged network interface, use the following command –

VBoxManage modifyvm "<virtualbox_instance>" --nic<nic> bridged

<virtualbox_instance> refers to the UUID, or the name of the VirtualBox guest; while <nic> refers to the numeric identifier associated with the relevant network interface card. For assistance with obtaining this information, refer to " Obtaining information about Virtualbox virtual machine instances".

If necessary, the type of network interface presented to the guest platform may be amended using the following command –

VBoxManage modifyvm "<virtualbox_instance>" --nictype<nic> <nic_type>

<nic_type> may be one of the following strings --

"Am79C970A" which refers to the emulated driver for the AMD PCNet PCI II network interface;

"Am79C973" which refers to the emulated driver for the AMD PCNet FAST III network interface;

"82540EM" which refers to the emulated driver for the Intel PRO/1000 MT Desktop network interface;

"82543GC" which refers to the emulated driver for the Intel PRO/1000 T Server network interface;

"82545EM" which refers to the emulated driver for the Intel PRO/1000 MT Server network interface; and

"virtio" which refers to a further network interface called a "paravirtualized network adapter" which is software layer designed to reduce the overhead associated with emulated network interfaces.

Despite amending the network mode for the guest platform to "bridged" and being able to connect to certain services such as DHCP to obtain a dynamically assigned network address, a subnet address, a subnet address mask and a default gateway the guest platform may have difficulty communicating with systems and devices on the physical network such that –

  1. attempts to contact or ping other machines on the same logical or physical network fail reporting "network unreachable", lost packets or similar errors; and
  2. attempts to contact or ping the guest platform from other machines on the same logical or physical network fail reporting "network unreachable", lost packets or similar errors.

These symptoms appear to flow from a mismatch between the MAC address that the guest platform uses to construct packets destined for the logical or physical network, and the MAC address of the physical or virtual network adapter presented to the VirtualBox host by the host operating system. The MAC address for a particular network interface presented to the guest platform may be amended using the following command –

VBoxManage modifyvm "<virtualbox_instance>" --macaddress<nic> <mac_address>

<mac_address> refers to the MAC address of the physical or virtual network interface adapter that constitutes the "bridged network interface".

The "bridged network interface" for a particular guest platform may be amended using the following command –

VBoxManage modifyvm "<virtualbox_instance>" --bridgeadapter<nic> <device_name>

<device_name> refers to the network connection or network device exposed to the VirtualBox host by the host operating system.

Note: This article was developed in connection with difficulties experienced running VirtualBox 4.2.4 in a container / zone on an OpenIndiana 151a7 host using a separate virtual network interface ("VNIC") as the bridged network adapter.

To mount a CD-ROM / DVD-ROM .iso image for a VirtualBox virtual machine instance

VBoxManage storageattach <vm_instance_name> --storagectl="IDE Controller" --port=1 --device=0 --type=dvddrive --medium=<path_to_iso_file>

To unmount the .iso image for the virtual machine instance

VBoxManage storageattach <vm_instance_name> --storagectl="IDE Controller" --port=1 --device=0 --type=dvddrive --medium=none

This guide is valid for VirtualBox 4.1.18 onwards, and on OpenSolaris 2009/06 onwards.

Installing VirtualBox in the global zone

To install VirtualBox in the global zone

pkgadd -d <VirtualBox_pkg>

Installing VirtualBox in a non-global zone

Once VirtualBox has been installed in the global zone, it may then be installed in the non-global zone as follows. Assuming the zone has already been configured and installed, the zone must be configured to add two devices, vboxdrv and vboxusbmon

zonecfg -z <vboxzone> \
"add device; \
set match=/dev/vboxdrv; \
end"

zonecfg -z <vboxzone> \
"add device; \ set match=/dev/vboxusbmon; \ end"

To install VirtualBox in a newly created zone, it may be necessary to install the SUNWpkgcmds (OpenSolaris 2009/06) / package/svr4 (OpenIndiana OI_151a) package to allow installation from .pkg files.

pkg install SUNWpkgcmds

or

pkg install pkg://package/svr4

There is also an undeclared / silent dependency on a package named SUNWuiu8 which appears to be a user interface / iconv / utf-8 localisation package. If this is not already installed in the zone you are installing the package to, the following error results whenever you try to do anything with the newly installed VBoxManage command.

/opt/VirtualBox/amd64/VBoxManage: error: Failed to initialise COM!

SUNWuiu8 may be installed from an IPS respository with

pkg install SUNWuiu8

or

pkg install pkg://system/library/iconv/utf-8

Thereafter, VirtualBox should function correctly within a zone. It may also be possible to configure the zone such that the files installed in the global zone are imported into the non-global zone by creating an appropriate loopback-filesystem as follows

zonecfg -z vboxzone \
"add fs; \
set type=lofs; \
set dir=/opt/VirtualBox; \
set special=/opt/VirtualBox; \
end; end"