Can't connect to Homestead (ping 192.168.10.10 fails)
I assume this is less of a homestead and more of a vagrant issue in general, still - maybe someone will be able to help.
I have a homestead box which suddenly stopped responding. I can do "vagrant ssh" and get into it, but I can't access my projects from the host machine (e.g. in the browser).
From my host machine (OSX), ping 192.168.10.10 times out
From within the homestead box (vagrant ssh works), ping 192.168.10.10 works and gets back to itself
On the homestead box, ifconfig returns 192.168.10.10 for eth1
On the host machine, arp -a doesn't list the box, but I'm not sure it would do that anyway
I have not modified my homestead.yaml apart from adding one project
It used to work normally a couple of days ago
I already tried:
Re-starting the box
Re-provisioning the box
Destroying and re-creating the box
All of the above worked without any unusual errors, but didn't fix the problem.
I now know what the problem is. Somehow, the box listens to 127.0.0.1:8000from the host machine instead of 192.168.10.10:80.
So I can test my projects now, with the hassle of having to append :8000 to the URLs. That's weird, the homestead.yaml specifically says to be available at 192.168.10.10 ...
I tried pinging 192.168.10.1, but still no luck. It times out as well.
Even tried matching the IP in the Homestead.yaml to 192.168.10.1 and reprovisioning+rebooting the box, but that didn't help either.
How can I find out if there's a mismatch within the network options? I just checked the virtualbox GUI, but it doesn't provide too much information under the network settings...
Have you tried restarting the host machine? if the host updated the kernel it could cause virtualbox to fail in wierd ways. A restart should re load all kernel modules including the virtualbox one and that could fix it.
What I found out is that you need to edit the Vagrantfile in the homeasted directory on line 29 to create private network. This allowed me to ping the 192.168.10.10 IP successfully and connect to database from HeidiSql.
Create a private network, which allows host-only access to the machine using a specific IP.
Sorry for necro-ing an old thread, but I also often ran into this issue, and as suggested by one of the reply, rebooting the machine fixes the issue.
Though I'm not sure what is the exact root cause, in my case it happens often enough that rebooting the machine isn't really an option (it seems to happen when I connect to some of my VPN).
So if anyone is also running into similar issue, rebooting the vbox network interface seems to also achieve the same thing without rebooting.
sudo ifconfig vboxnet0 down && sudo ifconfig vboxnet up on macos. You can see the interface the vm is using on the Virtualbox app.
@HENDRA - This works beautifully. I was searching for a way to accomplish this without having to restart my host machine. I was able to verify vboxnet0 in the Virtualbox GUI, and made one tweak to your suggestion:
sudo ifconfig vboxnet0 down && sudo ifconfig vboxnet0 up worked for me - making sure the interface name is the same in both directives. (Otherwise it would fail on my machine.) For those looking for where to find this info, in Virtualbox GUI, go to Machine Tools > Details to ensure details are being shown, and then look in the Network pane - for me it was Adapter 2 (Host Only Adapter, 'vboxnet0')
Just wanted to give you some kudos for providing this workaround that doesn't require the entire host machine to be rebooted!
In case anyone runs into this in 2021... It took me 4 hours to figure out the latest version of Virtualbox (v6.1.28) only supports IP Address in 192.68.56.0/21 range to be assigned to host-only adapters. Changing the IP in the Homestead.yaml file to "192.168.56.10" fixed the issue for me. Make sure your running as sudo user ie "sudo vagrant up". First post so I can't include a link
"On Linux, Mac OS X and Solaris Oracle VM VirtualBox will only allow IP addresses in 192.68.56.0/21 range to be assigned to host-only adapters. For IPv6 only link-local addresses are allowed. If other ranges are desired, they can be enabled by creating /etc/vbox/networks.conf and specifying allowed ranges there. For example, to allow 10.0.0.0/8 and 192.168.0.0/16 IPv4 ranges as well as 2001::/64 range put the following lines into /etc/vbox/networks.conf:"
@journeelabs Saved me a ton of time, after already having spent a couple hours, trying to figure out why my shared folders would no longer mount. Thanks!
Here, when connected to a VPN using a Windows 11 built-in solution, I couldn't ping/access the 192.168.10.10.
After DISCONNECTING from VPN, the virtual machine was accessible.