R – Is it possible to make localhost work through a Virtual Machine

development-environmentlampmacosUbuntuvirtual machine

I am using a Macbook running 10.6. I am using VMware Fusion to run an Ubuntu Server minimal virtual machine. Ubuntu Server is running your basic LAMP stack.

I do my development in Mac OS. I have VMware share a directory from Mac OS to the Ubuntu Server. Ubuntu Server uses that directory for apache.

I access my server is Mac OS in firefox using the ip address of my virtual machine. This is a pain because I have to find out what the ip address is of my virtual machine each time I boot it up. I could set a static ip address but this causes problems if I move my Macbook from network to network.

Is there any configuration (NAT or Bridged or something) that would let me access my virtual machine from the Mac OS using localhost or something similar?

Thanks

Best Answer

NAT should be OK. Your VM is on a different subnet that way, you can give it the static IP you like, and it won't interfere with the (dynamic) IP on your real network.