New IP Breaks VirtualBox and Homestead Vagrant - laravel

I had to replace my router which in turn gave my dev box a new IP address and has since broken my local VirtualBox with a Homestead/Vagrant Laravel image. Here's the error that I'm getting when running vagrant up or restore or --provision:
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set network interfaces...
The specified host network collides with a non-hostonly network!
This will cause your specified IP to be inaccessible. Please change
the IP or name of your host only network so that it no longer matches that of
a bridged or non-hostonly network.
Here's what I've tried so far:
Changed router base IP address map from the factory assigned 192.168.1.1 to 192.168.10.1 to get back to the same map from previous router of 192.168.10.1.
Reserved an IP address of 192.168.10.10 on my router and assigned it to my machine's mac address.
test results: same error of host network collision
Changed router base IP address map to 10.10.10.1
Reserved an IP address of 10.10.10.10 on my router and assigned it to my machine's mac address.
Replaced all 192.168.10.10 IP addresses in my project (homestead.yaml, homestead.rb, etc.) with 10.10.10.10
Updated my hosts file to point 10.10.10.10 to mysite.app
test results: same error of host network collision
Time Machine restored my entire machine image to a week ago
test results: same error of host network collision
Time Machine restored my entire machine image to today's backup
Reset router and all project files back to 192.168.10.10
Turned off Wifi (no network connection, no local IP address)
Run vagrant up
Confirmed host file maps 192.168.10.10 to mysite.app
test results: vagrant scripts run successfully, no error messages however I can only access the resulting local nginx site through http://192.168.10.10 and not http://mysite.app
Turn wifi back on (assigned IP is now 192.168.10.10)
results: can't access local nginx site at all, either via http://192.168.10.10 or http://mysite.app
Installed a fresh new laravel project and corresponding fresh new homestead box. Running vagrant up returns the same error message.
Rebooted many times during this process, same problems.
Deleted and reinstalled VirtualBox, same problem.
My initial diagnosis is that this has nothing to do with Laravel, nor homestead but is most likely caused by a VirtualBox setting or network connection.
Any suggestions are appreciated!
similar problem posted to laracast forum
same error message on SO

You've proven
vagrant up --provision
This recharges your yaml file
https://www.vagrantup.com/docs/cli/provision.html

Related

No access to web or mysql on vagrant after upgrading to macos monterey

Last week I decided to upgrade the mac to the latest version Monterey. Well. Most things works, except for Vagrant. Well.. it works, except there is almost no connection to the server.
vagrant ssh works.
I have been able to launch virtualbox, but access to http or mysql is not happening.
I know the mysql-server is running. The same goes with the apache server.
Logs have been checked and I cannot see that any traffic going to the server.
Ping is not working.
I have updated virtualbox. I have destroyed the box and upgraded vagrant / homestead. still no luck.
MORE INFO:
When I run traceroute I see that the first hit is the correct IP I have set in hosts file. Then it goes to 192.168.0.1 which isn't going anywhere.
I guess the 192.168.0.1 comes from the mac virtualbox / vagrant is running on.
Any pointers on what to do next are welcome.
Probably the same problem as mine (I couldn't use any longer IP 192.168.10.10). VirtualBox did some changes lately (from VirtualBox 6.1.28 I think) and a new configuration is needed to use your preferred (192.168.0.1) IP address:
On Linux, macOS and Solaris Oracle VM VirtualBox will only allow IP
addresses in 192.168.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:
* 10.0.0.0/8 192.168.0.0/16
* 2001::/64
You can check the whole information here.
Alternatively (skipping the networks.conf configuration) you can use any IP from the initially supported range like for instance: 192.168.56.10

Why can't I connect to 127.0.0.1 HortonWorks Dashboard?

I have installed Virtual Box (Version 5.2.0 r118431 (Qt5.6.2)) on Windows 10 and i imported appliance HDP_2.4_virtualbox_v3 (downloaded from here).
I followed the tutorial from here step by step.
The virtual machine is running on the computer from where I am trying to access the Dashboard. I have set up the Host Only Adapter Option on the sandbox so the computer and the virtual machine can communicate
After the CentOs finished booting I am prompt to enter to the ip 127.0.0.1:8888, which is a different address from the tutorial,
and there is no server listening to that address because i get
"127.0.0.1 refused to connect." in the browser.
image here
Run the ipconfig command in your command prompt and identyfy your virtual box's ip under Ethernet adapter VirtualBox Host-Only Network.
Take that ip address and go to your Virtual Box.
Select your appliance and go to Settings->Network->Adapter 1->Port Forwarding.
Replace the Host IP 127.0.0.1 for the port you need 8080, 8888 and so on with the ip of your virtual box that should be sth like 192.168.x.x.
Now start your sandbox, login on it and try to connect in your browser to the new ip set 192.168.x.x:8888.
Use appliance HDP_2.4_virtualbox because in the most recent some linux commands like netstat are considered deprecated and no longer function, which willmake your life harder when trying to debug or identify a networking problem.
If you still encounter issues eith it, reinstall your operating system, reinstall your virtual box and reimport the sandbox, make the changes needed in the Port Forwarding settings and it should be ok.
try to connect using 127.0.0.1 to connect make sure the VM is running make sure there are no errors if there are debug them and at the last straw uninstall the Vm and retry (make sure to make a backup if there are any files)
you can also try to check all the local host ips on your network and try to connect to them
Make sure you set NAT in your VirtualBox network settings:

Why "10.0.2.2" was not there with running "ifconfig"?

As you know I use vagrant to manage one vm, when I login to the vm using vagrant ssh, the output shown that I was login from 10.0.2.2. So this IP was my host's IP . But why can not I see it with running ifconfig in my host? That confused me. (But I can found a record about 10.0.2.2 in the host route table)
Any clue will be appreciated!
10.0.2.2 always points to the local host when you are running emulator or vm. So in virtual machine , it refers to the local host (127.0.0.1) as 10.0.2.2. That is the reason you can't see it in ifconfig in your host.
You can find more info in this thread.

vagrant / homestead up - connection timeout ONLY on home network

The problem
Whenever I run vagrant up (or homestead up for Laravel Homestead 2.0) I get a connection timeout error as follows;
(...usual 'vagrant up' stuff...)
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
(...left part out to reduce the size of this question...)
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
Important
Main key to this question is that this ONLY happens on my internet connection at home. When I'm at the office (different network) everything runs as expected. So this means it has something to do with my home network / router...?
What I'm running
Macbook Pro (late 2013)
Mac OS X 10.10.1
Router: Huawei HG556a with bridged Airport Extreme
What I've tried
I've tried so many stuff that Google almost doesn't give me new results anymore on my search queries, here are the most important ones;
Destroyed the box
Completely uninstalled Vagrant & Virtualbox, and reinstalled the latest (and tried with combinations of older) versions.
Increased the timeout to 600 and later 1200
Setting fixed IPs in the Vagrantfile
Forwarded to different ports through the Vagrantfile
Set my mac to use the DNS 8.8.8.8 and 8.8.4.4
Enabled the GUI which results in homestead login:, which is the same compared to when it works just fine at the office. Even tried logging in with user vagrant and pass vagrant
I really hope someone can give a working solution, I've seriously been at it a couple of days now...
Of course, solutions and good answer will be rewarded with upvotes and marked as answer!
Don't forget to add the "domains" for your Nginx sites to the hosts file on your machine! The hosts file will redirect your requests for the local domains into your Homestead environment. On Mac and Linux, this file is located at /etc/hosts. On Windows, it is located at C:\Windows\System32\drivers\etc\hosts. The lines you add to this file will look like the following:
192.168.10.10 homestead.app
In windows, you have to run notepad as an administrator when accessing and editing your etc/hosts file
I had the same issue.
In my case I destroy the homestead box and recreated it and all work
just fine since.
I just ran the following:
- homestead destroy
- homestead up
Hopes it helps.

Point Vagrant to a Local API

Hey guys I have two vagrant machines running, one is the app code base and the other is the api code base for the app. I want to be able to do a curl call from my app machine to the api machine.
On my computer I can call both because I have them in my etc/hosts file, but what do I need to do to successfully request from vagrant to vagrant.
I tried to go into my app vagrant machine's etc/hosts and add the domain with the 127.0.0.1 but no cigar.
So it turns out that Vagrant makes your guest machine's ip to 10.0.2.2. So what I did on my App code base vagrant machine. I edited the /etc/hosts to;
10.0.2.2 api.local.com
previously I tried 127.0.0.1, and that didn't work, so I just checked the apache access logs saw the ip and gave that a whirl. and that worked.
On my local machine I have;
127.0.0.1 api.local.com
I hope this helps.

Resources