views:

1240

answers:

3

I have a local test/development server (http, of course), listening to port 8000,

I'm working on Linux, so to test the page on IE6/7/8 etc I run a virtual machine using virtual box; I also need to see how it look on firefox in a windows environment (fonts for instance are different).

In my real machine, I open the website simply using the URL http://localhost:8000, how do I address this localhost from the virtual machine?

Right now my workaround is to use the IP address. Any better ideas?

+3  A: 

You most likely have your virtual machines networking set to NAT. If you set your networking to Bridged you should be able to access your host machine by its hostname.

See the VirtualBox documentation for instructions on how to set your networking setttings to Bridged.

Nick Haddad
hmm, for some reason the gui (on my machine) doesn't have this option!
hasen j
what version are you using? I found that on Mac, some of the base manual docs are completely different.
benc
+7  A: 

Googling turned this up: http://agaric.com/note/localhost-from-a-virtualbox-xp-install-ubuntu

It suggests using IP: http://10.0.2.2, and it worked for me.

So, I edited the hosts file, C:\windows\system32\drivers\etc\hosts, and added this entry:

10.0.2.2   outer
hasen j
I did notice in ipconfig (Windows in VirtualBox) that the default router for my VirtualBox is that IP address... so that makes sense to me.
benc
This worked on my macos with virtual box. Thanks a lot it made my day!
marcgg
A: 

Just do ipconfig on your host box. See what your ip is. Then use that ip instead of localhost in the virtual machine.