Skip to content

How to Setup Port Forwarding in VMware Workstation 9

This small walkthrough explains how to configure a port forwarding in VMware Workstation 9. The same procedure should also work for VMware Workstation 8, 7 and 6.

Why do you need port forwarding in VMware Workstation? The main purpose is to make virtual machines available on the network. You could simply use bridged networking, but sometimes NAT fits better to your requirements. If you want your virtual machine to be available no matter what network you are connected to or if you are limited in IP addresses you might have a valid use case for using NAT and thus port forwarding.

Configuration Parameters

  • VMware Workstation 9 running on Windows 7 Ultimate
  • The Virtual Machine is an Ubuntu 11.10
  • The virtual NIC is configured with DHCP
  • I want to make the SSH (22/TCP) available to the network

1. Open Virtual Machine Settings (Rightclick -> Settings...) and set your virtual machines network connection to "NAT"
vm-nat
2. Power on the Virtual Machine and write down the IP address (You could also use a static IP address)
vm-nat-guestip
3. Open Virtual Network Editor (Edit -> Virtual Network Editor...)
4. Select VMnet8 / NAT and press NAT Settings...
vm-nat-virtual_network_editor

5. Click Add
6. Configure Port and IP address
vm-nat-net_settings
7. Press OK twice to close NAT Settings and Virtual Network Editor

Finish! You virtual machines SSH service should now be accessible to the network with your workstations IP address. Needless to say that this is just an example and the port forwarding will also work with any other TCP/UDP Port, as long as it is not in use by your host.

If it does not work, check your Windows Firewall:

How to setup a custom Firewall Rule in Windows 7

1. Open Windows Firewal with Advanced Security (Run > WF.msc)
firewall_1
2. Rightclick Inbound Rules and press New Rule...
firewall_2
3. Select the rule type Port
firewall_3
4. Select TCP and specify Port 22 (If you are not forwarding SSH select corresponding protocol/port)
firewall_4
5. Select Allow the connection
firewall_5
6. Enter a name to identify the rule later
7. Leave everything else at its default unless you know what you are doing
firewall_6

17 thoughts on “How to Setup Port Forwarding in VMware Workstation 9”

  1. Thanks for this. Is it possible to do the port forwarding to multiple VM? For example, I want to be able to RDP into any VM I create without having to manually enter each VM's IP. So in step 6 above, can i put a wildcard for the IP address like 192.168.80.* (Or leave it blank?)

    1. No, definitely not. You can't assign a Host Port twice. (from where should it know to which virtual machine you want to connect?) You can, if you want to forward RDP zu multiple VMs, create multiple portforwardings and assign different Hosts Ports (eg. 3389/3390/3391/...) and forward all that ports to their respective virtual machines on port 3389. But you have to create an entry for every VM.

  2. I've 2 NICs on the Windows host machine (host IP for first: 43.X.Y.Z, host IP for second: 168.X.Y.Z) and I followed your guide. Now I can ssh in to my virtual ubuntu from the IP of first NIC but not from the IP of second NIC. any suggestions?

  3. How to access from other host machine. i have installed on my vm redhat 6.4 and the IP address is too 192.168.2.129 and my host machine IP address is 192.168.1.132. could pls give the instructional for setting for the port forwrding.

  4. Pingback: HOWTO port-forward services running in VM – rina rudyanto

  5. Pingback: Accessing web server running on VM from external network – About Oracle and more

  6. I have done Port Forwarding in VMware Workstation for HTTP port 80 on Host to HTTP port 80 on VM. It works for internet clients can browse through home page in VM. But FTP commands of home page cannot work (It seems that FTP is not over HTTP). Any suggestions?

      1. After I added FTP ports forwarding as you suggested, internet clients can't browse through VM. It means that VM is unable to connect internet (Checked by pinging http://www.google.com). If I remove FTP ports, VM can connect internet. Any more suggestions?

      2. Sorry for my mistake. I forgot to stop FTP on host. VM can connect internet after I did that. But it still doesn't work as you suggested. (Restart VM already)

  7. I did port forwarding because I ran a pydoc server on Ubuntu guest, like pydoc -p 8899, and I want to access it from host webbrowser. pydoc's underlying http server somehow is configured to listen to localhost only, like this:

    $ netstat -ltnp
    tcp 0 0 127.0.0.1:8899 0.0.0.0:* LISTEN 3899/python2.7

    thus I forwarded my guest port 8899 to host port 18899 and access http://localhost:18899 in host firefox.

    I'm fairly new to virtualization and webdev, is this a proper use of port forwarding?

  8. I need to config forwarding of 10,000 ports. But there you can add only one rule at a time in the VMware Workstation 12 Virtual Network Editor . Could you help me?

Leave a Reply to Pornthep S. Cancel reply

Your email address will not be published. Required fields are marked *