Here's my setup:

  • I have a local server running on my machine (Mac OS, Snow Leopard). I can access it via my browser by doing

    localhost:3000

  • I have a virtual machine using Virtual Box running a windows XP. If I try to access using localhost:3000, it fails. Same thing if I use the ip of the Mac machine.

  • The virtual machine has access to the internet.

How can I access my local server in my virtual machine?

link|improve this question

25% accept rate
feedback

4 Answers

Are you accessing via localhost within the Virtual Machine or on the Host System? If from the Host System I suppose your Network Settings for the Virtual Machine are set to NAT. There was this question before. Have a look on http://serverfault.com/questions/87148/python-simple-http-server-and-virtual-machines-cant-connect-ip-changed. There I explained how to set up a Port Forwarding so you can access the service using localhost:3000.

If the Network Settings are NOT set to NAT you should check the IP address from your virtual machine and access via :3000.

Hope that helps. :-)

link|improve this answer
+1 had the same prob. Changing the network settings to NAT fixed it for me. – cop1152 Nov 24 '09 at 14:32
feedback

It's difficult to say what might be occuring but a good place to start would be with installing Wireshark (if you don't have it already) and sniffing the traffic on the OS X side during a connection attempt. You might want to do the same on your VB XP installation. Feel free to post the traffic back here.

link|improve this answer
feedback

It will be easy if you start installing your virtual machine with bridge network at the first time, then you can do first test by ping your virtual OS through host OS, with condition you need to set up your local IP first, f.e 192.168.1.5

After that you can start installing your webserver, whether it's apache or else.

link|improve this answer
feedback

Here is what I do:

The address you need to point at is http://10.0.0.2:3000. That will get you to the htdocs directory, i.e. your http://localhost:3000.

Now that is useful for getting to the localhost dir but it doesn’t get give you access to your custom sites. Here is how you point 10.0.0.2:3000 back to the more familiar localhost:3000 as well as access any custom local url's you have set up:

Open your Windows host file. It is found here: C:\windows\system32\drivers\etc\hosts

Under the bit that says: 127.0.0.1 localhost

add the following (using whatever your actual project is called): 10.0.2.2 whatever

That’s it! Now you can visit http://whatever:3000 from within your virtual Windows environment.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.