Creating and deleting VNICs in OpenSolaris

A physical network adapter is also called a Network Interface Card or in short a NIC. The Crossbow project in OpenSolaris added more virtualization capabilities to the existing network stack starting from OpenSolaris Build 105. The latest OpenSolaris version 2009.06 has Crossbow features enabled.
A virtual NIC, or in short a VNIC, is a pseudo network interface created over an existing physical NIC. A phisical NIC can have more than one VNICs on it. Each VNICs created will have a separate MAC address. It is possible to make use of Crossbow's resource management to control bandwidth through VNICs.
In OpenSolaris with Crossbow, it is possible to create virtual NICs using Data Link Administration command dladm. To create a virtual NIC over an existing physical NIC, e1000g0, execute# dladm create-vnic -t -l e1000g0 vnic1
We passed -t to dladm to indicate that the VNIC is to be made temporary meaning that the VNIC is available until we either reboot the system or delete it through dladm. To create persistent VNICs, remove -t from the above.
The option -l e1000g0 indicate that the VNIC is to be created over physical interface e1000g0. The name of newly created VNIC will be vnic1. This was passed as last argument to dladm.
To delete an VNIC, we again use dladm command.# dladm delete-vnic vnic1
To make use of VNICs created through dladm, they need to be plumbed and assigned a valid IP address. In short, VNICs are similar to any physical NICs once they are created.# ifconfig vnic1 plumb# ifconfig vnic1 1.1.1.1 up# ifconfig vnic1 down# ifconfig vnic1 unplumb




