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:
ipconfig
It should dump out something like this:
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 10.0.2.15
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.2.2
In this example, the guest can reach the host machine 10.0.2.2
.
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
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
In this example, the guest can reach the host machine 192.168.1.1
.
Related: http://stackoverflow.com/q/19933550/1157054 http://stackoverflow.com/q/16244601/1157054
– Ajedi32 – 2015-07-21T15:09:01.9772Difficult to solve without any hint which network confiuguration your guest actually has. Some do not allow access to host. Try the default gateway address of the guest. – Turbo J – 2011-07-15T01:12:28.710
9Turns out I can reach it through my default gateway at 10.0.2.2. – Naftuli Kay – 2011-07-15T01:42:21.087