Thursday, July 24, 2008
Feb 18

Written by: Antonio Chagoury
Monday, February 18, 2008

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:

DynDNS

It will use the authentication details you provide, and perform the change on your behalf.

Step-By-Step Setup

On your virtual machine:

  1. Change the RDP listening tcp port as instructed in the following URL: http://support.microsoft.com/kb/306759
    Changing RDP TCP Port 
  2. Open Windows Firewall and add your custom tcp port to the exceptions list Windows Firewall Exception

On your router:

  1. 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)
    Router Single Port Forwarding

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.

Tags:

4 comments so far...

Re: RDP Into your Virtual Machine From Anywhere

At my last company I setup a MS Virtual Server that all our devs used for product testing. Whenever they needed access to the VPC they would VPN into the network and then they could RDP into the VPC without any problem. I much prefer the VPN based solution since it didn't require me to punch a bunch of holes through the router and was much more secure. Of course the VPN tunnel added some overhead so things were not quite as snappy as going direct, but the added security was more than worth it.

By Joe Brinkman on   Tuesday, February 19, 2008

Re: RDP Into your Virtual Machine From Anywhere

Hey Joe,

You are absolutely correct.
However, I would like to point out that this article is catered more specifically to folks that have a home based business, do not have the resources or knowledge to successfully deploy a Virtual Private Network (VPN) or setup Virtual Server. Keep in mind, that the audience I am targeting does not need to access multiple VM's, just the one :)

Good point though, thanks for your input.

By antoniochagoury on   Tuesday, February 19, 2008

Re: RDP Into your Virtual Machine From Anywhere

Can't live without that

By Nick on   Saturday, February 23, 2008

Re: RDP Into your Virtual Machine From Anywhere

I have the same exact setup... I have been meaning to blog my setup, but now I don't have to. Thanks.

By Emad Ibrahim on   Wednesday, June 11, 2008

Your name:
Title:
Comment:
Add Comment    Cancel  
Search Blogs
Blogs
Archives
DNN Modules

DNN VirtualEarth by Inspector IT, Inc.

Price: $99.95
Sale: $69.95


DNN SiteMap by Inspector IT, Inc.

Price: $79.95
Sale: $49.95

 

Blog Roll
Friends
Telerik Partner