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?
You just need to forward the ports that you want (which you can do in VirtualBox's network settings), then connect to the IP of one host from the other host's VM. As @TJJ said, your other option is to used bridged networking instead of NAT, which would let the computers connect with no extra configuration.
localhost is a special hostname that almost always resolves to 127.0. 0.1. If you ask someone else to connect to http://localhost they'll be connecting to their computer instead or yours. To share your web server with someone else you'll need to find your IP address or your hostname and provide that to them instead.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With