How can I remotely connect to VM outside of Internal Network without connecting to Host Machine?

2

I am running Windows 7 in a VM: The VM was setup using Hyper-V within Windows Server 2012 R2. First, I configured the Linksys router Port Forwarding for TCP 3389 and 3390. To both IP addresses. I also created Firewall Inbound Rules for Port 3389 and 3390.

To connect within Network, I simply enter the VM IP address or Computer Name, username and password and the connection is successful. I am also able to connect to the Host Machine out of my local Network by using the Public IP address.

The Problem: When I attempt to access the VM, lets say at a Caribou or the Library, or any other outside Network, I am landing into the Host Machine instead of the VM.

For example: To log into the VM outside, I used the same Public IP address, the username and password to the VM but I am landing in the Host machine with an error message that the user is invalid.

I have also tried the following: Computer Name:3389 but not successful.

How do I access the VM so that the connection is not going to the Host?

Asynchronous

Posted 2015-02-09T15:26:27.410

Reputation: 123

Do you have the port forwarding setup on different ports? Are you specifying the port when you try to connect? – heavyd – 2015-02-09T15:35:43.763

is your guest connected by a Bridged network connection, or one using NAT? if bridged, point your router's port forward rules to the guests IP address, not the host. if NAT, look into how to configure a port forward rule in the HyperV NAT. – Frank Thomas – 2015-02-09T15:36:26.567

I have both IP's set to port Forwarding. Host IP on 3389 and VM IP on 3390. If I do this: Public IP:3390. I get Unable to Connect To Remote PC. – Asynchronous – 2015-02-09T15:47:05.383

did you change the guests listener port for RDP to 3390? http://support.microsoft.com/kb/306759

– Frank Thomas – 2015-02-09T16:29:57.347

Just to clarify, am I making this modification for (listener port for RDP to 3390) on the VM? Meaning in Windows 7 which is running in the VM? – Asynchronous – 2015-02-09T17:35:00.610

Yes!! Yes!! It worked, I noticed that in the Registry, the Port was 3389 instead of 3390. This also explain why the connection was going to the host and not the guest. Changing the port and restarting the computer allowed the connection. Now I am curious: Do I really need to use Port 3389 and 3390? Can I use my own numbers? For example: 1111 and 2222? Thank you so much. – Asynchronous – 2015-02-09T19:10:58.983

yep, you can arbitrarily select any port you wish, though I recommend picking one between 2000-10000, so you have fewer issues with firewalls between your client and your LAN at home. glad you got it working. – Frank Thomas – 2015-02-09T19:16:54.300

How do I mark this question as answered? – Asynchronous – 2015-02-09T19:21:08.127

Answers

2

In order for the described scenario to work, the Guest machine must listen for remote desktop connections on a different port than the host does, unless you use bridged networking. To set the RDP server to listen to 3390, set the following registery key to "3390":

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber

Then restart the Remote Desktop service, or reboot the machine.

Frank Thomas

Posted 2015-02-09T15:26:27.410

Reputation: 29 039