Sun xVM VirtualBox and Host Interface Networking – OpenSolaris 2008.05 as Host OS
By Hashamkha Pathan on Jul 28, 2008
The Sun xVM VirtualBox allows you to tun run unmodified OS as virtual machine. The current version available is 1.6.2. You can get it from here. It redirects you to Sun Download Center.
Sun xVM VirtualBox is Type-II hypervisor which means you install it
on top of the base OS – often called Host OS. You can then create
virtual machines – often called Guest OS. If you are not familiar
with the hypervisor concepts and terms used in the Server
virtulization topic, you may want to look at this Sun Blueprint Article by Chien-Hua Yen
of the cool thing about Sun xVM VirtualBox is that, it support all
major operating systems as Guest and Host OS.
Networking & Guest OS:
NAT(Network Address translation) is the quickest and easiest way to get access to external network from the virtual machines(Guest OS). This access method is transparent to the users as it does not require any changes on Host OS or the Guest OS.
you require access to the Guest OS from external network (e.g. remote
access using SSH, NFS, Windows Share etc) NAT method is not
sufficient. In such cases, you may want to look at “Host
Interface Networking”. More information on this is available in
the user manual for virtual box available here.
In nut shell, this process involves creating a virtual network interface and use of "network bridge" concept. The steps below are for Sun xVM VirtualBox running on OpenSolaris 2008.05 as Host OS and Solaris 10 07/08 as Guest OS. Installing “Sun xVM VirtualBox” , and “Creating and installing Solaris Virtual Machine” steps are not included. I must admit, steps for installing Virtualbox on OpenSolaris and creating virtual machine with Solaris Guest were quite straight forward.
My observations is that, on some of the OpenSolaris Builds, the “setup scripts” don't work out of the box. You can use the below given steps for MANUALLY configuring the host based networking for your Guest OS. In this case, the Guest OS is Solaris 05/08 .The same should work for other Guest OS.(Host Configuration Steps remain the same)
Manually Configuring the Host based Networking:
Step 1: You need a MAC address for the virtual NIC to be created. One way to generate this is to Click on Virtual Machine Settings, Network Tab, Generate MAC. Note down the MAC address.
Step 2: Create the Virtual NIC on the HOST OS
-bash-3.2# uname -a
hasham-pc 5.11 snv_86 i86pc i386 i86pc
/usr/lib/vna nge0 00:e0:81:5b:a8:a9 <= Provide MAC Address from
Verify the Virtual NIC is created.
-bash-3.2# dladm show-link
LINK CLASS MTU STATE OVER
nge0 phys 1500 up --
vnic 1500 unknown nge0
3: In order for this configuration to persist across reboot, create a
startup script. You can use the simple script as given below. If you
plan create multiple VNIC OR already have VNIC, this script can be
enhanced to handle specific VNIC. Currently it deals with “vnic0”
Step 4: Go to Virtual Machine Settings(In this case Solaris 05/08), Network Tab and provide the details of the Virtual NIC. As shown in the picture below. Note that attached to default to NAT, it has been changed to “Host Interface”
-5: Boot your Guest OS – In this case, Solaris 05/08, and
configure the Network Interface as DHCP or Static IP address. In
this case, the Virtual NIC is as seen by Guest OS is e1000g0. One of
the easy way to re-configure your network and system configuration
FOR Solaris is to use “sys-unconfig” command. Note that this
revert system system's configuration to an "as-manufactured"
state, ready to be re-configured again including host name,
networking, TZ, root password etc. I prefer configuring it bye
editing/creating the configuration files.
You should be able use the VNIC in the same way for ANY other Guest OS. I have tested this with Windows XP as Guest OS and works fine. No changes in the HOST OS configuration steps. On Windows XP Guest OS, network configuration was changes to use DHCP. Based on your Network Interface card, you may be required to install driver for it in the Guest OS.
See screen shots below for making changes to the Virtual Machine Configuration to use Host based Networking.
Windows XP Virtual Machine Screen shot - Intel NIC Listed under "My Network". Also access to/from other systems on the network works.