Configuring a Web server on a virtual machine that uses NAT mode networking
search cancel

Configuring a Web server on a virtual machine that uses NAT mode networking

book

Article ID: 308774

calendar_today

Updated On:

Products

VMware Desktop Hypervisor

Issue/Introduction

This article provides steps to configure a Web server on a virtual machine that uses NAT mode networking.

Environment

VMware Workstation 11.x (for Windows)
VMware Workstation Pro 15.x (Linux)
VMware Workstation 6.x (Windows)
VMware Workstation 7.x (Windows)
VMware Workstation 8.x (Windows)
VMware Workstation Pro 15.x (Windows)
VMware Workstation 9.x (Windows)
VMware Workstation 10.x (Windows)
VMware Workstation Pro 14.x (for Linux)

Resolution

A virtual machine running on NAT network mode does not have an IP address which is accessible on the external/physical network. Network elements on the external network cannot access the virtual machine, unless the virtual machine initiates the contact. Therefore, the Web server application running on the virtual machine cannot access the external network. To overcome this limitation, the Virtual Network Editor provides an option to enable port forwarding for a particular IP address on NAT network mode, so that all traffic coming to the host machine through that particular port is routed to the virtual machine.

To accomplish this:

  1. Power on the virtual machine and note the virtual machine's IP address. Ensure that the IP address is set to Static.
  2. Power off the virtual machine.
  3. In the VMware Workstation toolbar, click Edit > Virtual Network Editor.
  4. Select the vmnet NAT adapter which you have configured on the particular virtual machine.

    Note: vmnet8 is the default NAT adapter.
     
  5. Select the NAT Settings option. The NAT settings dialog appears.
  6. Click Add. The Map Incoming Port dialog appears.
  7. Enter these details:
    • The host port – An unused port. For example, you can use port 9997
    • The virtual machine port – The port number of the Web server running inside the virtual machine
    • The virtual machine IP address – The IP address of the virtual machine that you want to connect to the NAT connection, noted in Step 1
    • Set the type as TCP
    • Add a description.
  8. Click OK.
  9. Power on the virtual machine and configure the Web server as required. Ensure to use the same port number that you configured in Step 7 for the Web server on the virtual machine.

You should now be able to access the Web server installed inside the virtual machine using <HostName>:<port>. For example port 9997, which you selected in Step 7 or <host address ip network on physical>:<port></host>.

Note: For the Hostname option to work, the host name must be resolvable on your network.


Additional Information

For more information on the different networking types available in VMware Workstation, VMware Server, and VMware Player, see Understanding networking types in hosted products (1006480).
 
For more information on using the Virtual Network Editor, see Using the Virtual Network Editor in VMware Workstation (1018697).
NAT モードのネットワークを使用している仮想マシン上で Web サーバを構成する