An audience of two

All | CEC | FBinfo | General | Humour | iPhone | Java | Music | W(h)ine | X64

20080527 Tuesday May 27, 2008

Configuring host networking for VirtualBox
I decided to take a look at VirtualBox recently. We had just received a new 4150 with four dual-core CPUs and 8Gb RAM, so it seemed silly not to. Plus I needed a Solaris 10 system and this was running nv_87

First impressions: VirtualBox is pretty slick. It installs easily and the User Interface is clean and intuitive. (You can insert your own sarcastic that's-cos-we-didn't-write-it comment, I'm above things like that.) I did have some minor issues with virtual machines hanging, particularly during installation, but that was easily resolved by increasing the amount of memory to 1024M (default of 512M is just too small) and enabling VT-x under the Advanced settings. The only real problem I had was with the networking; I simply couldn't get it to work.

By default the system provides a virtual NIC configured with NAT. The idea being that this is intended as a desktop solution primarily; you probably want to run this on your laptop and are happy if it can see the interwebs. So you leave the settings at teh default, select DHCP networking when you install Solaris and you're away. But that's no use if the virtual OSes need to talk to each other, or you need to log in remotely.

So reluctantly I consulted the manual. But in this case the manual wasn't clear either; there was lots of info about configuring for Linux but not much for Solaris. I got anecdotal hints from a few people - Solaris prefers the Intel PRO/1000 device driver, try using /usr/lib/vna rather than the vnic_setup script - but still no joy. I could snoop the network but couldn't get out.

Finally Bertrand Lesecq, a Support Engineer from Sun France gave me the final piece of the puzzle - thanks Bertrand. So here it is. Enjoy.

First off, you need to configure a virtual NIC using /usr/lib/vna To do this, use ifconfig to find out what the physical nic is. On my system it's

e1000g0: flags=201004843 mtu 1500 index 2
        inet 10.5.239.60 netmask ffffff00 broadcast 10.5.239.255
        ether 0:1b:24:df:ee:8 
To configure the virtual NIC you just run /usr/lib/vna (interface) (mac address). My interface is e1000g0 and its real mac address is 00:1b:24:df:ee:08 I decided to change the last octet to 8A. Having configured the NIC you plumb it (this step may/should not be necessary depending on who you talk to, but I did it and it worked) but you must not assign an IP address.
# /usr/lib/vna e1000g0 00:1b:24:df:ee:8a
vnic0
# plumb vnic0
Now virtual NICs won't survive a reboot, so I decided to write a simple startup script. Since I intend to have 5 virtual hosts I need 5 VNICs. Here's my script. No, I didn't use SMF. I'm old school. Bite me.
# cat /etc/rc3.d/S99vnic 
#!/sbin/sh
state="$1"

case "$state" in
'start')
        echo 'Plumbing VNICs'
        for MAC in 8a 8b 8c 8d 83
        do
                VNIC=`/usr/lib/vna e1000g0 0:1b:24:df:ee:$MAC`
                ifconfig $VNIC plumb
        done
        ;;

'stop')
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;

esac
The next thing to do is to tell VirtualBox to use the virtual NIC. Simply click on a host that's powered off, click the Settings button and click Network. Ensure that Enable Network Adapter and Cable Connected are checked. For Adapter Type select Intel PRO/1000 MT Desktop (82540EM). For Attached to select Host Interface. Change the MAC address to the address you provided to vna earlier. Under Host Interface Settings type the VNIC name, vnic0

Now go ahead and install Solaris on the virtual node. When it comes up it should see an ethernet adaptor e1000g0 which you can configure with a real IP address. The system should behave exactly like a real system; you can ping the router (which you cannot under NAT) and ssh into the host remotely, assuming that you have the services configured to allow that.
Permalink del.icio.us | furl | slashdot | technorati | digg Comments [5]
Tags:


Stinkin' Badges

Santa Cruz Mountains wine info on Wikispaces


follow davetong at http://twitter.com

Add to Technorati Favorites

www.flickr.com
This is a Flickr badge showing public photos from davetong. Make your own badge here.

Locations of visitors to this page

Calendar

« November 2009
MonTueWedThuFriSatSun
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
      
Today

RSS Feeds

XML
All
/CEC
/FBinfo
/General
/Humour
/iPhone
/Java
/Music
/W(h)ine
/X64

Search

Links


Navigation



Referers

Today's Page Hits: 297