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.
- 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"
2. Power on the Virtual Machine and write down the IP address (You could also use a static IP address)
3. Open Virtual Network Editor (Edit -> Virtual Network Editor...)
4. Select VMnet8 / NAT and press NAT Settings...
5. Click Add
6. Configure Port and IP address
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)
2. Rightclick Inbound Rules and press New Rule...
3. Select the rule type Port
4. Select TCP and specify Port 22 (If you are not forwarding SSH select corresponding protocol/port)
5. Select Allow the connection
6. Enter a name to identify the rule later
7. Leave everything else at its default unless you know what you are doing
Does it possible to forward port for IPv6?
No, this is not possible. Furthermore IPv6 was designed to get rid of NAT.
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.
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?
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.
Can this be used to access website on linux vm from host?
where 9095 is forwarded port
Pingback: HOWTO port-forward services running in VM – rina rudyanto
Pingback: Accessing web server running on VM from external network – About Oracle and more
if i have kali 2 on my vm worsktation 9 platform, how can i port forward so i can access the net
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)
netstat -ano | findstr :22
i don't see port 22 is listen in win 7. please help me
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?
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?