Port Forwarding to a VMware Workstation Virtual Machine

I am running VMware Workstation 8 (build 471480). I want to setup a small content server, mainly for images and such for my website, on my desktop in a virtual server (just for the heck of it)... I now have everything installed on a VMWare virtual machine running Ubuntu Server and already have the web server running. I have tested it and it works fine within the network when accessing it from the host.

I now need to make it work on the public Internet and am planning on using noip.com, as i have done on many other occasions.

The problem is that my router is a Linksys E2500 and it only allows port forwarding to IPs within its subnet (192.168.2.**)

The host system connected to the router has an IP of 192.168.2.177. The VMware Workstation 8 virtual machine has a Network type of NAT and the IP for the server on it is 192.168.43.130.

I have already forwarded port 80 and 22 to 192.168.2.177, but how can i get my Windows 7 system to then forward that port to the server ip?


As discussed in Root Access chat:

  1. You don't need to do port forwarding. Just use bridging to make your guest ask for an IP address on the router's own subnet, so the guest will have an IP like 192.168.2.178 (for example). It is recommended that you use bridging instead of trying to figure out how to convince VMware's NAT adapter to do port forwarding.

  2. VMware Workstation 8 Manual page 144 (at the bottom) and the next couple of pages describe in detail how to set up bridging.

  3. General idea is to use the Virtual Network Editor to change your connection type to bridged instead of NAT, and make sure that the adapter you edit is being mapped into the VM in the VM's settings pane. That's it -- if everything is set up properly on the host side, your guest will get an IP on the router.


Actually the proper solution is forwarding port to guest, but not reconfiguring whole network.

You need to add port to vmware config file nat.conf

[incomingtcp]
#<external port number> = <VM's IP address>:<VM's port number>*
#(this maps guest port 80 to host port 81)
81 = 192.168.100.1:80

On Windows, you can access the Virtual Network Editor (it's on the start menu). From there you can select the NAT interface (VMnet8), click "NAT settings", and get to the point where you can set up a port forward to your VM. It works similarly to the NAT port forwarding setup on a typical router.

Bridge mode is an easy workaround but I'm in an environment where we don't want anyone attaching VMs to the network willy-nilly. NAT makes more sense to keep things isolated.