Archive for virtualization

Setting up VirtualBox Guest VM Server Networking via NAT

I recently took Atlassian up on their Starter Pak deal to help manage some personal projects I’m hoping to kick off. I’m a big fan of their work, and their entire suite has performed extremely well for us at work for the last 3 years.

While I could run the software directly off of my iMac, my preference (and the environment I’m ultimately most comfortable in) is to run them under Linux. To accomplish this, I downloaded the latest version of Xubuntu and installed it within VirtualBox for OS X. Being the lazy man that I am, I did a plain-vanilla VirtualBox install.

After a quick apt-get to install OpenSSHd (and trying to connect via the host OS back to the guest), I realized that the default network settings would not allow me to see back into the guest OS (Xubuntu) from the host (OS X) (The other way around works fine, btw).

The VirtualBox documentation presents a few different ways to resolve this (NAT, Bridged and Host-Only). Once again, I decided to take the path of least resistance…which is to do simple port-forwarding from the host OS to the guest OS. The result is that when a resource is requested on host OS port, it just forwards the request to the mapped guest OS port.

I have 3 primary services that I’m looking to forward: SSHd (22), Apache (80) and Tomcat (8080)….so my mappings look like this:

Host OS Port 2222 –> Guest OS Port 22 (SSHd)
Host OS Port 10080 –> Guest OS Port 80 (Apache)
Host OS Port 18080 00> Guest OS Port 8080 (Tomcat)

When VirtualBox is installed, it places a few command line utilities on the host OS. The command that is needed to setup port-forwarding is VBoxManage. There are 3 values that must be set for port-forwarding to work: Protocol, HostPort and GuestPort. Below are the commands I executed to setup SSH port-forwarding:

VBoxManage setextradata "Xubuntu"
  "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP

VBoxManage setextradata "Xubuntu"
  "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22

VBoxManage setextradata "Xubuntu"
  "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

The value “guestssh” is somewhat arbitrary…it just needs to be the same for all 3 values. The other difference you might have is if you have chosen a different virtual network adapter (pcnet) when you setup your VM. When in doubt, check the VirtualBox documentation.

That’s basically it…just rinse and repeat for any other services that you want to run on the guest OS and have visible from the host.

Testdrive: OpenSolaris on OS X with VirtualBox

I finally got around to installing VirtualBox (read more about it here and here) on my Mac earlier this week.  Last night I installed the OpenSolaris (2008.5) disc that I picked up at the Sun booth at OSCON last week.

So far, everything has been going swimmingly.  I could walk you through the installation, but this dude at MacWorld did a much better job than I could.

The only trouble I’ve had thus far was learning some Solaris-specific commands (pkgadd, btw) to install the “VirtualBox Additions”.  The VirtualBox Additions are a small selections of add-ons that you install within the guest OS to ease integration with the host OS (mouse control, shared folders, etc).  While I’m not familiar with Parallels, I can say that VMWare (Workstation/Player) has a very similar guest additions installation procedure.

I’ve been using VirtualBox on my Vista desktop for a few months to virtualize a Xubuntu server (sshd, apache, mysqld, etc) with great success.  Typically, the VM is utilizing less memory than iTunes, which I find utterly ridiculous.  I decided to give it a spin on my MacBook Pro because the latest update of VirtualBox has brought the Intel Mac version out of beta.

While I don’t think that VMWare has much to fear from VirtualBox in the enterprise arena, for the average developer/desktop user, VirtualBox should suit you well.  I’ll be interested to see if Parallels and VMWare will be able to continue charging $80 for their consumer versions with such a capable free competitor (backed by Sun, no less) available.

OpenSolaris Impressions

Playing with OpenSolaris has generally gone well.  It helps that the UI is Gnome and the default shell is BASH, two things that most Linux folks should be comfortable with.  Cruising around the filesystem answered one of my main questions, which was that JDK6 (not OpenJDK, mind you) is installed by default.  I still haven’t figuresd out what mechanism, if any, OpenSolaris uses for automatic updates.  If anyone has some good “OpenSolaris for a Linux Guy” articles…please pass them my way.

OpenSolaris guest running on OS X host.

OpenSolaris guest running on OS X host.