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

Leave a comment ?

15 Comments.

  1. Does it possible to forward port for IPv6?

  2. 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?)

    • 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.

  3. 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?

  4. 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.

  5. Can this be used to access website on linux vm from host?

    e.g. http://localhost:9095

    where 9095 is forwarded port

  6. HOWTO port-forward services running in VM – rina rudyanto - pingback on May 20, 2016 at 8:56 am
  7. scott mckinley

    if i have kali 2 on my vm worsktation 9 platform, how can i port forward so i can access the net

  8. 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?

    • Forward FTP Ports (20/TCP & 21/TCP)

      • 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?

      • 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)

  9. netstat -ano | findstr :22

    i don't see port 22 is listen in win 7. please help me

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>