How to access my local server on my VirtualBox virtual machine?

How do you have your network setup in the Virtual Machine?

It sounds like you might have it setup using NAT. In this situation, if your host machine(Mac) has a non-routable(private) IP address such as 192.168.x.x, you will not be able to reach the host from within the virtual machine. The reason you cannot reach the host from the guest is that you are essentially setting up 2 separate private networks. Your Mac computer is on one (192.168.x.x) and your VM on another (perhaps 10.x.x.x) and you essentially have a router between them. Since routers will not route private IPs, the two networks can never communicate with each directly.

If you want your host and guest machines to be able to communicate, you will probably want to setup your VirtualBox network adapter to be attached to the "Bridged Adapter." This will share your internet connection with the virtual machine and allow your guest machine to talk to the host. In this situation you are essentially adding your VM as an additional node to the local network your Mac is already on.


Depending on the network settings of your vm, you'll probably need to add an additional IP to the Host OS that's on the same subnet as your vm so they can communicate. Your vm probably has a 192.168.x.x address, so add a similar address to the Mac machine:

example, if the vm has 192.168.1.99 and subnet mask 255.255.255.0, you can do this to your host:

ifconfig eth0:0 192.168.1.199 netmask 255.255.255.0 up

you'll probably need to restart the adapter as well.


I have had the same exact problem, only I was using Windows 7 as a guest.

What I did was Start -> Run -> cmd to bring up the command line.

ipconfig to bring up connection details. Look for the address that looks like 10.x.x.x, that's your Mac.

Now, use that to connect to your local server on your Mac.

For me, it's usually something like http://10.0.2.2:80/blah