VirtualBox supports VNIC (Virtual Network Interface) templates for configuring VMs over VLANs.[41] A VirtualBox VNIC template is a VNIC whose name starts with "vboxvnic_template" (case-sensitive).
Here is an example of how to use a VNIC template to configure a VLAN for VMs. Create a VirtualBox VNIC template, by executing as root:
dladm create-vnic -t -l nge0 -v 23 vboxvnic_template0
This will create a temporary VNIC over interface "nge0" with the
VLAN ID 23. To create VNIC templates that are persistent across host
reboots, skip the -t
parameter in the
above command. You may check the current state of links using:
$ dladm show-link LINK CLASS MTU STATE BRIDGE OVER nge0 phys 1500 up -- -- nge1 phys 1500 down -- -- vboxvnic_template0 vnic 1500 up -- nge0 $ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE VID vboxvnic_template0 nge0 1000 2:8:20:25:12:75 random 23
Once the VNIC template is created, all VMs that need to be part of
VLAN 23 over the physical interface "nge0" can use the same VNIC template.
This makes managing VMs on VLANs simpler and efficient, as the VLAN
details are not stored as part of every VM's configuration but rather
picked from the VNIC template which can be modified anytime using
dladm
. Apart from the VLAN ID, VNIC
templates can be created with additional properties such as bandwidth
limits, CPU fanout etc. Refer to your Solaris network documentation on how
to accomplish this. These additional properties, if any, are also applied
to VMs which use the VNIC template.
[41] Support for Crossbow based bridged networking was introduced with VirtualBox 4.1 and requires Solaris 11 build 159 or above.