I'd essentially like to access my host computer from the guest in VirtualBox. Is there an IP address given for my host which I can use from the guest? Are there extra steps required to set this up? I'd like to access my host's Apache, FTP, and SSH services.


4 Answers 4


This answer is about pretty much an guest OS setup in VirtualBox; you just need to use the network gateway address on the guest OS to connect to the host OS from a guest OS.

In the default Vagrant setup, you should be able to reach your host through the default gateway.

On Windows based guests, you can easily determine this IP address by running the command:


It should dump out something like this:

Windows IP Configuration

Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . :
        Subnet Mask . . . . . . . . . . . :
        Default Gateway . . . . . . . . . :

In this example, the guest can reach the host machine

On Unix/Linux based guests, use the command:

netstat -rn

It should dump out something like this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 wlan0     U         0 0          0 wlan0         UG        0 0          0 wlan0

In this example, the guest can reach the host machine

  • Any idea why connectivity would be horrendously slow when connecting using the default gateway as per your answer? Commented Apr 15, 2015 at 11:39
  • This didn't seem to work for me (Ubuntu 12.04, Vagrant 1.0). Default gateway inside the guest showed as, and a nmap of that IP failed. seems to be the right IP. (I had config.vm.network :hostonly, "" in my config.)
    – Ajedi32
    Commented Jul 21, 2015 at 14:40
  • Actually, never mind. It did work. nmap just wasn't working for some reason; not sure why. I could still connect to services running on the host from that IP, even though nmap wasn't showing them.
    – Ajedi32
    Commented Jul 21, 2015 at 15:03
  • 1
    netstat -rn on CentOS 7.2, Docker 1.11 displayed a 172.17 address as my gateway, but that IP didn't match up to my host. It turns out that did. Commented Jul 21, 2016 at 16:48
  • 1
    How do we know which one of those entries is the gateway?
    – Kramer
    Commented Dec 3, 2018 at 15:49

Accessing the web server of host computer from the guest is easy. This can be done easily using two methods. First do the following

  • In VirtualBox go to Devices and select Network Adapters...

  • In the adapter settings, check for Attached to.

  • If the value is NAT, do following

  • The default gateway when you setup Virtual box is generally as default value. If you have not changed anything this will work. But if you have changed it and the guest machine you are running is windows run following command and find the default gateway

    ipconfig /all

    If you are on Linux, Unix or Mac OS, run the following command to get it

    netstat -rn | grep 'default' | awk '{print $2}'

  • Go to the web browser and type in this default gateway and press enter. The web server can be accessed.

  • If the value is Bridged Adapter, do following

    • find the ip address of host and guest
      • if you are on windows, run ipconfig and get the ip address
      • if you are on Linux, Unix, or Mac OS, run ifconfig | grep 'inet' and get ip address
      • the ip address is like
    • if you want to access host, run browser in guest and enter ip address of host
    • if you want to access guest, run browser in host and enter ip address of guest
  • 1
    Note that on linux the -n argument to netstat makes it print "default" as "" (also grep is not needed): netstat -rn | awk '/default|^{print $2}'.
    – hlovdal
    Commented Dec 26, 2020 at 20:44

Another way to do this is to use a "Host" type of virtual network. That gives you an interface in the guest OS with an address on a local subnet different from the "outer world" subnet(s) that your host machine is on. To make this work, you have to make sure of a few things:

  • Your VM has a "host only" adapter configured;
  • Your host services need to be listening on all local adapters, or at least the ones you want to be able to contact;
  • Your host will get its own virtual adapter, and you'll want to figure out its IP address and add it to the "hosts" file in your guest OS (however that works for the guest OS; on Windows XP, it's just the "hosts" file buried in C:/WINDOWS/system32/drivers/etc). Give it a name you want to use for the host's host name.

Once you've done this, you should be able to "see" the host from the VM via the name you coded into the host file.

For example, on my Ubuntu 11.04 host, I get a "vboxnet0" virtual interface on The adapters in the machines come up with something like I don't need to go in to my VMs, but I presume that'd be possible via a symmetric change to the host's host file. I add mymachine

to the guest OS host files, and they can (for example) see my host machine's web server at


You can of course have both bridged and host-only adapters set up.


You can create shared folders in VirtualBox. This will automatically create a 'network share' within Virtual Box to access folders in your Host OS.

Here's a decent step by step in a Windows XP guest OS:


  • So I can access my host at /vboxsvr/ShareName ? Commented Jul 14, 2011 at 23:10
  • Yes, you would set a folder like C:\STUFF to be shared with VirtualBox. Within VirtualBox Guest OS, you can go to that vboxserver and access the shared folders.
    – kobaltz
    Commented Jul 14, 2011 at 23:12
  • I actually don't want the shared folder. I want an IP address for my host machine. When I get it, I'd like to use it to use services on my host machine, ie: echo "GET /\r\n\r\n" | nc 80 (send a HTTP GET request to my host machine from the guest.) Commented Jul 14, 2011 at 23:15
  • 2
    In that case, you may need to set your Guest OS network adapter to a Bridge. This will pull an IP address from your DHCP or Router. You would then be able to natively access your host machine through IP address instead of the VBox Shared Folder.
    – kobaltz
    Commented Jul 14, 2011 at 23:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .