Vagrant + WSL2 unable to ssh into VM, firewall issue?


I’m trying to run Vagrant inside Windows 10 with WSL. The VM runs on VirtualBox on the windows host. I’ve been able to boot the VM and can connect to the VM directly from VirtualBox. However, vagrant up fails with the message:

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.

When running vagrant ssh the ssh command times out. Looks like vagrant on WSL is unable to connect to the VM. Do anyone know what the problem is? Is there a firewall setting I need to update in order to connect to the VM?

Possibly, Vagrant or Packer running from WSL try to connect to which is WSL IP and not Windows host running VirtualBox, see Windows11 Host + WSL + ansible to provision Windows Server/Client - #2 by mloskot