Geeks With Blogs
New Things I Learned

Had a short training on VMWare on Tuesday, the software development department finally got the official permission (read: get a license) to use VMWare Workstation.  I’m no stranger to Virtual Machines (VMs) – started playing with Virtual PC 2005 a fwe years back and I understood the general concepts of hardware virtualization.  The biggest problem I have with VMs in general is the slowness; I’d rather develop directly on my PC, which is faster.  Can’t say I’ve delved deep into it, but I know enough to utilize it and be dangerous .

Regardless, virtual machines provide a way to simulate multiple computers and I’ve done 3-tier software testing (client to app server using WCF and app server to SQL 2005 backend) to verify our framework can support both 2-tier (client –> DB) and 3-tier deployments.  Rarely used it for development, again due to speed.

Fast forward to the current time, I’d like to be able to do some coding on Windows 7; unfortunately Windows 7 is not quite sanctioned yet to be deployed, and it’s a pain to have to dual-boot.  I do have Windows 7 at home, but got way too many experimental stuff on it .  So, I’m setting up a Windows 7 VM so I can do some coding on it.

Now, nothing wrong with running the VM within VMWare, but I always find that it is a bit sluggish unless I go to full screen mode.  If I do so, it’s a bit of a pain to go back and forth between the host and the VM, and it also means that I have to do it at the host.  Ideally, I’d like to remote desktop into it (for whatever reason, I also feel remoting into a VM session makes for a snappier UI response).

However, this is not immediately possible to do without some setup; out of the box VMWare provides VNC connectivity, so you can use that but I am spoiled by remote desktop – it is just way nicer than VNC.  Of course one of the advantages of VNC is that if someone connects to it, the original don’t lose the view of the PC, so different tools for a different job.

In any case, I’d like to be able to remote desktop into my VMs – there are 2 ways to set this up, one is faster but it is considered as ‘nice’ and may cause problems with typical corporate network setups.  Let’s look at the first approach:

image

The first approach is to set up the VM setting to have it’s network adapter be a Bridged connection.  This basically sets the VM to use the host’s network card as if it were its own network card.  This also means that the VM will get an IP based on the host network’s settings (usually DHCP-based).  Essentially it brings the network connectivity of the VM to be at the same level as the host.  Now, in a corporate environment (usually domain-based), this may not be allowed, or you may have trouble with accessing the network at all if your VM is not added to the domain.  On a local (home) network, it also means it can communicate with other computers on the same network (good), but if it gets infected with a worm / virus it can also spread to the other computers (bad).

Depending on your environment, bridging may be fine and if you can do that then by setting it to Bridged mode you can then remote desktop to the VM (you have to remember to turn it on within the VM).

However, in my current situation, setting a VM network in bridged mode is not condoned and we have to set it to NAT setup.  Each VM that you spun will then get a typical internal IP address (192.168.XXX.XXX); but that means you cannot get to it from the outside.  So what to do?  The answer was provided in this post by rsa911– I’m just providing the nice UI snapshots (and also as a reminder for me on how I got it to work in the future).

In NAT mode, each VM is given an internal IP address and VMWare essentially becomes the bridge between the host and the VMs that runs in it.  Fortunately, you can do port forwarding to these internal IP address.  As detailed here, Remote Desktop uses port 3389 to listen to incoming RDP requests.  So what we need to do is forward an unused port to each VM’s port 3389 and we should be able to remote into them.  Let’s see how that’s done.

image

To do port forwarding, we need to access the Virtual Network Editor from VMWare Workstation (under the Edit Menu –> Virtual Network Editor).  The dialog above should show up – select the network adapter that is set to NAT.  Then click on the ‘NAT Settings…’ button, the following dialog will show up:

image

Click on the ‘Add’ button, and a dialog to map incoming port shows up; the dialog below is filled with the following information:

  • Listen to port 9997
  • Any TCP communication to that port, forward it to the VM with IP of 192.168.118.130 on port 3389 (default RDP port)

image

Tweak it to satisfy your setup – the host port just needs to be an unused port (in this example I use 9997), the VM port needs to be 3389 (unless you’ve changed it) and the VM IP address needs to be the IP address assigned to the VM you’re running (in Command Prompt run ipconfig to easily see this); this is what my output looks like:

image

When done, click OK and the NAT Settings dialog will show up your port forward:

image

So now I’ve set up VMWare so any incoming request to port 9997 will be forwarded to port 3389 on the VM that has IP of 192.168.118.130.  Remember that for Remote Desktop to work, you still need to make sure your VM has RDP enabled and you have users with passwords added as Remote Users.

The question is then how do you issue the remote desktop request?  Well, you use the host’s IP (or machine name) as the target, but you provide the port number as well:

image

The VMWare is hosted in my laptop (mbudimane6500) and I’m providing the port RDP should use (9997).  Remember that in a domain environment it’ll try to login as a domain user (DOMAIN_NAME\username format), so if your VM machine is not part of a domain you have to change the username to use to log in.

If you’ve done everything as mentioned above, now you can remote desktop into your VM machines in a NAT environment .  Remember also that you have to do the port forward for every VM that you wanted to remote into – each one will have a different IP address and each one will need to have a different port number.  Hope this helps others.

Posted on Friday, November 13, 2009 8:42 AM Windows | Back to top


Comments on this post: Connect to VMWare virtual machines using Remote Desktop

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Thanks Man, very helpful.
Left by JerryO on Nov 25, 2009 5:30 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Nice post mate. I was using the bridged mode first. But your second option is much safer.

Thanks alot
Left by dotslasher on Dec 03, 2009 10:47 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Hi,
Thanks for the nice article,I am almost there.

Does this apply vmware server as well?

I have vmware server installed on my home PC(A) and running a VM Machine(B) on it. I am trying to RDP into that VM(B) from my work place computer(C).
Do I need to assign a static ip address to the guest(B) and also do i need to portforwarding on the router at home as well.

Thanks
Left by K on Mar 02, 2010 3:50 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Nice tip, came in handy at the right time. Thanks.
Left by Praveen J on Mar 02, 2010 10:01 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
To K (please provide email next time):
I don't have experience with VMWare Server, but I would imagine the process will be very similar (if not exactly the same).

To answer your question, it really depends on the set up you have. If your VM machines are set up to use bridged connection, then you only need to port forward on the router at home to the RDP port set up on the guest (B) machine.

If you use NAT, then the guest machines IP won't be visible from the router, thus you still have to provide the translation from the host machine to the guest machine (you also still need to port forward on the router to your host (A) machine).
Left by Muljadi Budiman on Mar 02, 2010 12:36 PM

# Awesome article!
Requesting Gravatar...
Wow, what a great article! Thank you so much this was exactly what i was looking for!!!!
Left by Dan on May 12, 2010 9:25 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
is this working if im tryng to acess through internet?
Left by asking on Jun 04, 2010 6:35 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
This was a fantastic article. EXACTLY what i was looking to do. RDP and then VM Workstation just wasnt cutting it for me. I thank you sir
Left by KC Abramson on Jun 11, 2010 10:43 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Ugly Thanx 2 days headache solved ! See u
Left by kfakfa on Jun 17, 2010 1:05 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
There is another easy way of doing this too. I use my router to assign a static IP address to my host using the host MAC address. This is so much easier.
Left by Philip on Jun 30, 2010 4:51 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
... and don't forget to activate this port in windows firewall :D ...


btw for those who use vmwareplayer: vmnetcfg is included in the install-file but won't be installed. Fortunately you can extract the exe by using /e switch; for detailed information search google or look here http://communities.vmware.com/message/1397634
Left by anse on Aug 05, 2010 5:38 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Thanks for your EXCELLENT pictorial guide. Made something that could've been quite painful very simple.
Left by Moshe on Aug 08, 2010 4:55 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
You can also use "localhost" as the hostname of the local machine. For example localhost:9991
Left by Brian on Aug 16, 2010 3:20 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
I need it for the KVM, someone to help me?
Left by Raul on Aug 31, 2010 8:30 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Excellent, just the info I needed!
Left by David on May 09, 2011 9:45 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
thanks/ very usefull article
Left by kirill on Sep 12, 2011 8:08 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Very interesting article ! Thanks
Left by Fred on Sep 15, 2011 11:19 PM

# Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
I am running an internet cafe using thinclient boxes. These thinclients are pulling Windows XP professional via remote desktop from a host computer. I need to time control all the thinclients from this host computer (I'll call it PC-1). To achieve this, I need a second computer (I'll call it PC-2) that will house the server version of the cyberclock while PC-1 will house the client version of the cyberclock. Rather than purchase another PC, I opted to run your Vmware machine to act as PC-2. All the thinclients and PC-1 are lan connected on an ethernet swith to enable communication.
Now, I decided to swap roles by making PC-1 to become the Vmware VM housing the Guest OS, while PC-2 becomes the physical computer housing the Host OS. With this, the thinclients will have to pull their desktops remotely via RDP from the Vmware guest OS (PC-1) where the client-cyberclock will be installed; the server-cyberclock which resides on the Host machine (PC-2) will control the client-cyberclock.
I need a detailed guide on how to configure this setup to run as descibed above. Pictorial guide will really be appreciated. Many thanks.
-------------------------------------------------------------------------------------------
Brief setup Summary:

Thinclients ------->pull RDP session from windows XP pro installed on Vmware VM.

Sever-cyberclock installed on Host OS controls --------------> Client-cyberclock inside Vmware OS---------->controls all Thinclients.

Thanks in anticipation for your support.
Left by Drow on Nov 02, 2011 4:04 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Very well done. Thanks a LOT.
Go on doing it.
Regards,
Jakim
Left by Jakim on Nov 18, 2011 10:25 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Cavalier BS, know it all attitude. Clearly focused on a few secondary considerations of using VMware Workstations. My suspicion is you have never actually used the product. Really sad that crap like thos shows up when searching for real world information
Left by Slappy on Nov 19, 2011 6:40 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
thanks for help
Left by krishna on Nov 23, 2011 7:22 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
very nice
Left by Devarajan on Dec 04, 2011 4:30 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
I wanted to thank you for the post. I do alot of SharePoint developement and need to be able to RDP to my Server on VMware :-)
Thx again

Left by Worldunix on Jan 18, 2012 4:36 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Great Article bro :) keep up the good work
Left by Jojo Man on Mar 05, 2012 9:07 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Well explained. Thank you
Left by Saravanan on Mar 13, 2012 6:20 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Thank you, your post was helpful. Do you know if vSphere Client installed on the host can connect to the vCenter server installed on VM?
Left by Navil on Apr 12, 2012 10:09 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Thanks for the article, i still הhave a problem.
I can connect to the VM (Win SRV 2008 R2)
via mstsc only from the host, where the VMWare player is running (my desktop)
but when i try to connect from other computer (my laptop)
in my home network it failed.
when i send ping from the laptop,
i can't even get ping from the host (my desktop) or the VM
Left by N on Jul 13, 2012 12:22 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Wow! does this really works? So much information in this site. Thanks a lot for the info.
Left by jessa of memory improvement tips on Aug 06, 2012 7:11 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
I did use the same thing mentioned in the article.But cannot connect to the VM linux machine from windows 7.Any Idea how to solve it?
Left by Nirmal on Aug 15, 2012 2:21 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
This is excellent article. Good work.
Left by sri on Feb 16, 2013 7:35 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Hi, I have set up a virtual machine, xp professional. My connection is wireless connection. I did all those steps you provided, I cant RDP into my machine. I pinged the machine to see if it is alive. It is not picking up on the network. Help please
Left by zues on Mar 10, 2013 3:44 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
I didn't worked here until i openend port 9997 on the host (W7).
Left by Danny on Apr 20, 2013 7:03 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
I am on a domain environment, I have followed all the steps in the article. Just confused about what I need to key in on the RDC fields. When I try with my domain/username it doesnt connect. Any help would be appreciated, thank you in advance.
Left by Neonlights on May 22, 2013 8:16 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
show the code how to be connect and create remote vmware
Left by edrees yousif on May 27, 2013 5:27 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Nice post but it resolved my problem only 50%.

I have private network.
1. Router 192.168.0.100
2. Primary host machine 192.168.0.3
3. Host OS Win 7
4. VM connection - bridged.
5. Virtual machine - Win server 2008 - 192.168.0.128

What I want to achieve?
-------------------------
1. I want my vm to act as a server for my private network. Is it possible.
2. Can I access domain on server(VM) from machines connected to private network?

current problem ?
----------------------
1. I am able to ping my private network from virtual machine, but the private network cannot find virtual machines IP.
Left by Satish on Sep 09, 2013 10:42 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
My primary concern for remote access has always been security (I work with sensitive information). So, for me, the safest solution I've found thus far is RHUB
Left by John Click on Sep 19, 2013 7:21 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
VMware 10 by default remote desktop to my vmware based on its name I can connect to it but my vmware by default does not have a login/pass so how do I get in?
Left by N00b's N00b on Sep 24, 2013 7:50 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
You could just install Teamviewer on the remote VM?
Left by cabs on Oct 12, 2013 7:53 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
I knew this was possible! Thanks for the great tutorial, can't wait to go home and try it.
Left by Catherine on Mar 20, 2014 4:06 AM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Because VMware is not compatible with Macs, I wouldn't focus on using this primarily. I mean there is a dozen of other desktop hosting services which are compatible with all software systems and you even don't need to install them.. https://www.apponfly.com/en/
Left by Frank Lampard on Nov 23, 2014 9:31 PM

# re: Connect to VMWare virtual machines using Remote Desktop
Requesting Gravatar...
Well written article. Helped me a lot to transfer files from host to the guest VM's
Left by Siva Velusamy on Jun 22, 2015 4:03 AM

Your comment:
 (will show your gravatar)


Copyright © Muljadi Budiman | Powered by: GeeksWithBlogs.net | Join free