I have a MacOS X Mavericks host running Vagrant using VirtualBox as a provider. I have experienced several times that with different VMs (particularly Ubuntu Linux VMs) after the first time the VM is brought up host-only networking will not work.
Most recently I was running a Vagrant avenuefactory/wordpress VM. It was configured to have two adaptors #1 NAT and #2 Host-only 192.168.10.10/24. The VM brings up WordPress when started. Very nice except the Mac cannot see it until after I restart the whole machine. Both sides see the 192.168.10.0/24 network. Neither side can ping the other.
ifconfig on both sides shows the shared network interface
vboxnet0. From either side pings result in timeouts.
On the host I have tried the following:
- Restarting each VM and VirtualBox.
ifconfig <interface> downfollowed by
ifconfig <interface> upfor all IP interfaces.
scutil -r 192.168.10.10says the host is reachable. This is true but not useful.
route add 192.168.10.10 192.168.10.1 -iface vboxnet0adds a route successfully
killall -HUP configd(manually sending a Hangup interrupt to the
configdprocess to reset the network (and just about everything else) does nothing.
- logging out and back in the user does nothing.
- restarting the whole machine works every time, and then it's like nothing has changed but now it suddenly works. But the next time I start up a new VM, or when I quit VirtualBox and restart all the VMs, or just randomly, this situation can recur.
On the host:
# ifconfig vboxnet0 vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 ether 0a:00:27:00:00:00 inet 192.168.10.1 netmask 0xffffff00 broadcast 192.168.10.255 # scutil -r 192.168.10.10 Reachable # ping 192.168.10.10 PING 192.168.10.10 (192.168.10.10): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 ... # route add 192.168.10.10 192.168.10.1 add host 192.168.10.10: gateway 192.168.10.1 # ping 192.168.10.10 PING 192.168.10.10 (192.168.10.10): 56 data bytes Request timeout for icmp_seq 0 ... # ifconfig vboxnet0 down # ifconfig vboxnet0 up # ping 192.168.10.10 PING 192.168.10.10 (192.168.10.10): 56 data bytes Request timeout for icmp_seq 0 ... # VBoxManage dhcpserver remove --ifname vboxnet0 # VBoxManage dhcpserver add --ifname vboxnet0 --ip 192.168.10.10 --netmask 255.255.255.0 --lowerip 192.168.10.2 --upperip 192.168.10.254 --enable PING 192.168.10.10 (192.168.10.10): 56 data bytes Request timeout for icmp_seq 0 ... # arp -s 192.168.10.10 08:00:27:e2:2f:1c
...and the chorus continues. So then on the ubuntu guest:
# arp -s 192.168.56.1 0a:00:27:00:00:00
...and still nothing.
I followed advice found at https://forums.virtualbox.org/viewtopic.php?f=8&t=63998# but still have the problem. I cannot believe that I have to completely restart my Mac every time this problem happens (at random). Can anybody think of some less draconian than a restart to solve this?