I don't know about you, but for the past two years I have been using a virtual machine to do all my development.
The thought process is simple:
- I can back up the entire machine into one file
- I can have as many configurations as I wish (operating systems, IDE version DB Servers, etc)
- Clearly defines my business workspace versus my development workspace
- Well, there is lots more, but I am not try to sell you on using virtualization here, just how to access it from anywhere you want ;)
My setup is fairly simple:
- One powerful desktop machine running Windows Vista Ultimate and hosting Virtual Machines
- Software on this machine is limited to:
- MS Office and a few other business apps
- MSN Messenger
- Skype
- and a few other productivity tools.
My Original Problem
I like to work in front of the TV (and eat too, by the way), so the first thing I tried was to RDP into the host machine, and in turn from there operate the Virtual Machine.
Anyone who has tried doing this before will tell you: nice try!
Unfortunately, there are several issues with accessing the VM that way, including but not limited to video display issues. So without going into the endless details, that's out.
I then realized that I could actually see the VM listed in the DHCP client table on my router at one point, which meant that it is in fact networked and ping-able.
I decided I was going to RDP directly into the VM's locally assigned IP and see what would happen. Success! And what's more, it works great! The performance of RDP'ing directly into a VM hosted on another physical machine is no different than RDP-ing into any physical machine.
I used this set-up (from my TV Room, and Bed) for weeks and was pretty happy until I had to...
Access a Virtual Machine via RDP while outside of the comfort of your own Network
My bubble burst in a hurry when I had to access my VM while out of my home-office. I mean it was really important that I got access to that VM - really!
As I mentioned, the VM's host machine is in my home-office, and I only have one IP to work with. That IP was already bound to the RDP tcp port (3389) of the host machine, so that was taken. How can bind to the VM's IP+TCP PORT without removing RDP access to the host?
The Solution
Well, To put it short, I had a "Mac-Giver" moment. I figured that if there was a way to change the RDP listening tcp port of the VM, I could create an additional port-forwarding rule on my routers and voila! Theoretically, that made sense to me.
I did a quick search to find out if there is a way to change the RDP listening port, and found this resource provided by Microsoft: http://support.microsoft.com/kb/306759
Okay, now we are making good progress, but when trying to access the machine (from within my local network) with the new port specified I got denied access. Another light-bulb went on: Firewall! I added the port exception on the VM's firewall, and there it was: access granted!
Now that I had RDP access via custom port from within my local network, I needed to enable access from the outside.
I logged into my router and accessed the port-forwarding admin screen and added a new rule for the new custom port and forwarded it to the VM's bound local IP address.
Presto! - I could now access BOTH my host machine and VM via RDP using the SAME IP address! (Just different ports).
See the step-by-step instructions below for setup details.
How to Deal with a Dynamic IP Address?
Yes, your IP "could" change between the time you leave your office and the time you need to use your VM, although unlikely.
I addressed this issue by using a FREE Hosted DNS service: www.dyndns.org
DynDns.org allows me to point an FQDN (Fully Qualified Domain Name) to an IP that I specify. This allows me to connect to my RDP boxes via Friendly URLs such as http://mydevelopmentmachine.dyndns.org so that I don't have to remember the IP.
My router, a Linksys WRT300N, supports Dynamic DNS Updates (DDNS). What this means is that the router is capable of changing the IP address directly at www.dyndns.org as soon as it detects that my ISP changed it. Here is what the admin screen looks like:

It will use the authentication details you provide, and perform the change on your behalf.
Step-By-Step Setup
On your virtual machine:
- Change the RDP listening tcp port as instructed in the following URL: http://support.microsoft.com/kb/306759
- Open Windows Firewall and add your custom tcp port to the exceptions list

On your router:
- Add the newly created tcp port to the port forwarding rules and point it to the VM's bound local IP address. (In the table below, .100 is the HOST machine, and 104 is the VM's bound IP)

I cannot even begin to tell you how useful this was for me, but I am always willing to learn new things and find other better ways to accomplish the same set-up, so if you have any tips and/or suggestions, please feel free to share them below.