Accessing Localhost hosted on one virtual machine by another virtual machine

ServAce85 picture ServAce85 · Jun 26, 2011 · Viewed 9.7k times · Source

Background:

On my Windows 7 machine I have a web development virtual machine running Ubuntu. The VM's network structure is set to NAT (as opposed to bridge, etc.). I run additional virtual machines of XP with different IE browsers on them for testing.

My Question:

I know that when using NAT on a virtual machine, you are able to access the web server from the host inside of a virtual machine by directing a web browser to 10.0.2.2. If http://localhost is hosted on Virtual Machine A (Ubuntu). How do I access that from Virtual Machine B (any XP VM)?

Edit:

I am looking for an elegant solution, similar to that of using 10.0.2.2 as described above. I would prefer not to have to specify dynamic IP's for the VM's as well as not having to look up the VM's IP every time I want to access it. Is anything like this possible?

Answer

markbarton picture markbarton · Jun 26, 2011

Just put the IP address of VM A instead of localhost in the browser of VM B.

This assumes theres no firewall rules preventing it from being accessed.

Its worth doing a ping test from VM B first to eliminate any other issues first.