How to set up VirtualBox remote display for VM access anywhere

IT admins searching for an easy way to remotely access VMs can use Oracle VM VirtualBox remote display. Still, setting up remote access doesn't come without its headaches.

VirtualBox remote display makes it easy to access your VMs from anywhere, but the feature's initial setup is a...

whole other story.

Oracle VM VirtualBox is free, open source desktop virtualization and server virtualization software. Using VirtualBox, you can access virtual machines (VMs) in three ways: through the VirtualBox software interface itself, through whatever interfaces are available in the guest VM (a terminal session, Virtual Network Computing, Remote Desktop Services or what have you) and through the remote display system.

The remote display system is a built-in feature that's both powerful and frustrating. VirtualBox remote display uses Microsoft's Remote Desktop Protocol (RDP) to make the desktop for any VM -- not just Windows, and not just guest operating systems that have the VirtualBox guest extensions installed. It's frustrating, however, because it takes a finicky step-by-step process to get the VirtualBox remote display to work.

Once it works, you can access a VirtualBox guest VM from just about anywhere, so you're not limited to the console it's running on. Here's how to set up Oracle VM VirtualBox remote access:

Adding VirtualBox remote display extensions

Here is the list of installed extanseions in VirtualBox's settings. See Add Package on the right.

First, you need to install the extensions that enable the VirtualBox remote display system. On the VirtualBox download page, you'll find the Oracle VM VirtualBox Extension Pack, which adds a number of features: USB 2.0 device support, PXE boot support for Intel-brand network cards and the VirtualBox remote display system. If you already have VirtualBox software installed, all you need to do is download the extension pack for your version of VirtualBox. There are different builds of the extension pack for 4.1.12 and 4.0.16, so make sure you pick the right one.

Before you add extensions, you should shut down -- not suspend -- all running VMs and close VirtualBox entirely. In Windows, you can just double-click on the extension pack or manually install it via the VirtualBox interface by selecting File > Preferences > Extensions and then choose the Add Package icon to the right of the list of extensions. If you're using the command line, use the VBoxManager extpack command to add the VirtualBox remote display extension.

Once you add the extensions, reboot the host computer. Simply stopping and restarting the VirtualBox software will not do the trick, and VirtualBox doesn't prompt you to reboot.

Setting VM ports

You're on your way to VirtualBox remote access, but you still need to separately configure each VM you want to access via RDP. This step is a little tricky: You declare a port number for each guest to receive RDP connections, but you connect to the host computer's IP address, not the guest. Each guest has to have a separate port number to prevent collisions.

Choose a port number for a guest VM. Each VM must have a unique port number for RDP access.

For instance, I have two VMs in VirtualBox that I want to access via RDP -- one running Windows and another running the alpha version of Haiku OS. The Windows VM is accessed through port 5001, and Haiku is via port 5002. In both cases, I connect to the IP address of the host machine but use the port of the VM in question: for Windows and for Haiku.

To set the port for a given VM, go to the Settings page for the VM and select Display > Remote Display. Check Enable Server and then choose a server port. You can do this while the VM is running or when it's stopped (but no

t when it's paused), and you don't need to restart the VM for these changes to take effect. I don't recommend using the default port assignment of 3389 if your host OS is Windows, because that may collide with an existing RDP server on the host.

More on VirtualBox software:

Oracle VirtualBox 4.1 brings critical virtualization capabilities

Open source desktop virtualization software options: VirtualBox and more

Preview: Windows 8 beta in VirtualBox

Next, the Authentication Method drop-down lets you choose one of three ways for remote clients to authenticate a connection with the VM. Null is just what it sounds like: no authentication, meaning anyone who knows the port number can connect. External uses an authentication library within the VirtualBox software to authenticate against the user credentials in the host system or via credentials in the VM's XML settings file. Guest is a future provision for allowing authentication against the guest OS's user credentials via Guest Additions, but this method isn't tested yet.

If you use Null as the connection library, you can connect to the target system at any time -- even when it's still booting. You're not just connecting to the OS running on the host, you're connecting to the host VM itself, so be very careful how you allow connections to a VM in the first place.

Managing VirtualBox remote display connections

Finally, connecting to a VM with the VirtualBox remote display system is the easy part. All you need is a client that speaks Microsoft's RDP, such as the Remote Desktop Connection client in Windows. On Linux, there's rdesktop or krdc.

A guest instance of Windows 7 accessed via RDP through VirtualBox. The display dynamically resizes.

The exact parameters you use to connect with the remote machine can make a difference as well. For instance, in the Windows Remote Desktop Connection client, one of the per-connection settings is performance optimization, which you can find in the Experience tab of the Options menu for the client. You can adjust these settings depending on whether you're using LANs or WANs, and they do make a difference.

If you have the VirtualBox Guest Additions, the display will automatically resize if you specify a resolution for the RDP connection. This feature of VirtualBox remote display is handy if you want to connect at a different resolution than the one on which the VM is currently running.

Finally, not every VM may behave the same way across RDP. An OS with the VirtualBox guest extensions tends to have more accurate mouse tracking than one that doesn't, for instance.

VirtualBox remote display provides a single, unified mechanism for remote access to VMs. It opens up a field of possibilities that you can't get from the local console.

Serdar Yegulalp
wrote for Windows Magazine from 1994 through 2001, covering a wide range of technology topics. He now plies his expertise in Windows NT, Windows 2000 and Windows XP as publisher of The Windows 2000 Power Users Newsletter and writes technology columns for TechTarget.

Dig Deeper on Virtual desktop software and vendors