Unable to Connect to Vagrant Guest VMs in a Private Network
I had a problem connecting to a vagrant virtualbox cluster from the host (OS X 10.10.4 Yosemite).
There are three hosts set up as a vagrant private_network, each having an assigned IP in the range 192.168.37.2 – 192.168.37.4
The virtual network I wanted to connect to (vboxnet0) had a status of Up and the hosts were running. I could connect with vagrant ssh
to all of the hosts in the network, but I was unable to ping the virtual host from the host OS.
arp -a showed no entry for the virtual network (vboxnet0):
? (192.168.0.1) at 14:cc:20:4c:37:40 on en0 ifscope [ethernet]
? (192.168.0.100) at b8:e9:37:ec:1c:c4 on en0 ifscope [ethernet]
? (192.168.0.106) at 14:10:9f:de:62:e7 on en0 ifscope permanent [ethernet]
? (192.168.0.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
vboxmanage list hostonlyifs
showed six other virtual networks setup, most with status Down, possibly from other vagrant installations
Running these steps fixed it:
-
Shutdown all nodes with
vagrant halt
-
Remove all the virtual networks with
vboxmanage hostonlyif remove vboxnet0
for every network returned byvboxmanage list hostonlyifs
-
Recreate with
vboxmanage hostonlyif create
. This recreated the vboxnet0 network which was the only one I was interested in -
Recreate with
vboxmanage hostonlyif ipconfig vboxnet0 –ip 192.168.37.1
This seems to reset the state, now I can connect to each of the hosts in the network.