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