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

144,363

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

Share:
144,363

Related videos on Youtube

Billy ONeal
Author by

Billy ONeal

Updated on September 17, 2022

Comments

  • Billy ONeal
    Billy ONeal over 1 year

    I've got a development webserver on an Ubuntu box inside of VMWare Workstation 7.1.3. I'd like to run a web browser on a Windows machine (the host OS) for actually testing a web page I'm working on -- hard to run IE tests in Ubuntu :)

    However, if I simply try to ping the IP given to the ubuntu VM (192.168.83.137) (or open it in my browser for that matter), it seems the host cannot communicate with the guest.

    How do I allow the guest OS to communicate with the host when the guest is running in NAT mode?

    • Alex Angelico
      Alex Angelico about 13 years
      I dont have the VMWare in this computer so I cannot try now, but I did this. What I recall was, there is an IP for NAT and one for Direct connection. If I'm not mistaken, I just opened the NAT address in my browser
    • Billy ONeal
      Billy ONeal about 13 years
      @Alejandro: That's what I thought too but it doesn't seem like the Ubuntu box is accessable that way.
  • Billy ONeal
    Billy ONeal about 13 years
    Well, I'm guessing firewalls were choking things up. Not an issue anymore.