VirtualBox network is not working?
“It Works on My Machine”: the mystery behind an inaccessible VirtualBox VM on MacOS Catalina.
In one of our recent migration projects, we came across one of those unfortunate incidents when you hear an application “works fine on my machine” and no amount of pleading or crying can provide a clue as to why it will not do so anywhere else… 🙄.
The project in question made use of Vagrant + VirtualBox for local environment deployment and testing. One of the developers had his own customised version of a VagrantBox, and for him everything worked like a charm. Let’s call him Developer 1. His workstation ran VirtualBox v6.1.34 + Vagrant 2.2.x + Ubuntu.
His teammate, on the other hand — Developer 2 — needed to update his local environment. His own workstation was a combination of MacOS + VirtualBox v6.1.24 + Vagrant 2.1.x.
Consequently, at least on paper, Developer 2’s plan looked fairly simple:
- Step 1: Upgrade his versions of VirtualBox + Vagrant (it was essential to use unified versions)
- Step 2: Install all other elements of the project.
Both steps were completed without any errors, and yet the results were far from expected — now the website, which was deployed within VirtualBox, was somehow inaccessible. What the –?
This was yet another mystery, so the team put on their thinking caps and as a result took the following measures:
- Check the log files
- Make sure that all services within the VirtualBox — php, ngnix, mysql, etc. — are working properly
- Access the page by using curl
Within the VirtualBox instance itself, everything seemed to be working well, without any apparent issues.
The team then decided to switch gears and check the VirtualBox host accessibility from the outside — using a simple ping command — which unexpectedly revealed that 100% of the packets were lost. While this was somewhat disheartening, it was a possible culprit for the entire conundrum.
They then followed this trail of breadcrumbs, and after a thorough investigation discovered that since the VirtualBox v6.1.30 update (a patch update, irony of ironies) HostOnly adapters have had to receive a different range of IP addresses:
192.168.55.х before the update
192.168.56.х after the update.
There it was hidden in plain sight in VirtualBox’s updated user manual:
User Manual“On Linux, Mac OS X and Solaris, Oracle VM VirtualBox will only allow IP addresses in 192.168.56.0/21 range to be assigned to host-only adapters.”
This was definitely an aha moment for everyone. After creating a new HostOnly adapter and replacing the one in the VirtualBox instance, the problem magically disappeared, the required web portion of the solution became suddenly accessible again and Developer 2 was finally content.
*Phew*. So that was finally dealt with, but the entire ordeal reminded us of the memetastically iconic Phyllis:
May she live forever.