Using RDP Clients with VirtualBox machines

"VirtualBox screenshot" by Kubuntu 11.04: Canonical Ltd.VirtualBox 4.1.8: Oracle CorporationWindows 7: Microsoft CorporationThis screenshot: FleetCommand (talk · contribs) - This screenshot is taken and uploaded by FleetCommand (talk · contribs). Licensed under GPL via Wikimedia Commons -

I’ve been working with VirtualBox a lot recently, but one obstacle I’ve banged my head against repeatedly was getting a Remote Desktop Client (like Microsoft Terminal Services Client, for instance) to successfully connect.  It was peculiar because I could ping the VM ip address, connect through SSH, made sure I had the Extension Pack installed and so on, but the RDP client just kept timing out without any helpful explanation.

Finally I went back and read the documentation and figured out my mistake.  I had assumed I should use the IP address of my virtual machine as the target, but according to the documentation (see below) I should have been using the IP address of the host instead.

Chapter 7. Remote virtual machines

Since VRDP is backwards-compatible to RDP, you can use any standard RDP viewer to connect to such a remote virtual machine (examples follow below). For this to work, you must specify the IP address of your host system (not of the virtual machine!) as the server address to connect to, as well as the port number that the VRDP server is using.

I guess VirtualBox on the host must provide some sort of proxy/passthrough service, and that you set different ports for each virtual machine if you need to switch back and forth between different VMs? So you might tell VM #1 to use port 3389, VM #2 to use port 3390, and so on, for example.

Hopefully this will save someone a little time and frustration (or remind me if I should forget) in the future.