How can I connect to a web server running in a VM when the VM is in NAT mode?

Solution 1:

I have this configuration working in my computer:

host: Windows 7

VMWare: openSUSE 11.x using NAT

If i run ifconfig on linux, I have this ip: 192.168.126.129. In the host I have adpater VMNet8: 192.168.126.1

I opened in the browser the URL: http://192.168.126.129/ and it opened the apache "IT Works" page

If this doesnt work, check the firewalls an/or if apache is listening at 192.168.126.xxx.

Solution 2:

You will need to setup port forwarding to the guest machine.

On the NAT tab in Virtual Network Editor, click Edit -> Port Forwarding. From here you can configure which ports are forwarded from the host machine to the VM.

For example, forwarding host port 8080 to the VM 192.168.83.137:80 should allow you to access the web server on the VM by going to http://127.0.0.1:8080 on the host machine.

For further information, refer to the VMWare Nat Documentation or the following article