Monday, July 2, 2012

VirtualBox VM basic networking

Multiple network setups are possible, depending on particular needs.
As an example, bridging is an interesting option for unrestricted connectivity.
It's important to let Solaris 11 itself provide the network virtualization.
Be aware that, on a guest, a vnic created on top of the assigned vnic won't work.
Be sure to reference an unused vnic in --bridgeadaptern option. 

$ dladm show-vnic 
LINK      OVER    SPEED  MACADDRESS        MACADDRTYPE  VID
vnic0        ?     1000  8:0:27:af:4c:5b   fixed          0
vnic1        ?     1000  2:8:20:e6:a6:24   random         0

 
$ VBoxManage list bridgedifs | less 
 
Don't assign to the VM any vnic already in use.
In this example, vnic0 can be assigned.

$ dlstat
 
$ ipadm show-if
IFNAME     CLASS    STATE    ACTIVE OVER
lo0        loopback ok       yes    --
net0       ip       ok       yes    --


$ VBoxManage modifyvm vm1  
  --nic1 bridged   
  --bridgeadapter1 vnic0
 
If under Solaris 10, to avoid problems, then you'd better have additional available physical interfaces to dedicate to VirtualBox VMs themselves. Furthermore, you may have to consider some NAT scheme, preferably disabling VirtualBox DHCP server.

As mentioned, don't create additional vnics on the VM. If the VM will have non-global zones, don't use the anet resource which implicitly create a vnic, but a simple net resource. On both cases, the end result would be a vnic on top of another vnic which doesn't work at all.