StefanScherer / windows-docker-machine

Work with Windows containers and LCOW on Mac/Linux/Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VirtualBox doesn't allow 192.168.99.0 subnet by default

jaraco opened this issue · comments

In VB #20626, I learned that with the release of VirtualBox 6.1.28 dropped support for host-only IP ranges outside of 192.168.56.0/21 (more details here).

The windows-docker-machine uses 192.168.99.90, outside the default allowed range.

Due to other issues on macOS Monterey, it's not possible to downgrade Virtualbox, so the only available workaround seems to be to edit the allowed ranges by creating/amending /etc/vbox/networks.conf to add something like:

* 192.168.99.0/24 192.168.56.0/21

It would be nice if the machine/Vagrantfile could use an address that falls into the allowed ranges such that it works out of the box.

I did also try applying this patch and it also seems to have worked around the issue:

$ git diff
diff --git a/Vagrantfile b/Vagrantfile
index c31e3e3..2ad69ed 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -86,7 +86,7 @@ Vagrant.configure("2") do |config|
     v.customize ["modifyvm", :id, "--nested-hw-virt", "on"]
     # Use the recommended paravirtualization interface for windows (hyperv) - requires VirtualBox 6
     v.customize ["modifyvm", :id, "--paravirtprovider", "hyperv"]
-    override.vm.network :private_network, ip: "192.168.99.90", gateway: "192.168.99.1"
+    override.vm.network :private_network, ip: "192.168.59.90", gateway: "192.168.56.1"
   end
 
   config.vm.provider "hyperv" do |v|

I'm yet unsure if changing the address there is likely to have any repercussions, but at first glance, I'm able to spin up a Windows docker guest and it's able to reach the network.

Thanks @jaraco for the report and your investigation.
Can I encourage you to make a pull request? It looks good and would merge it if it helps on Monterey with latest VirtualBox.

Submitted as #80.