So here is the thing...I really struggled to get this working. After finally taking a break and googling better I have some simple steps that I want to write so I don't forget.
To Note: I'm using windows 11, vagrant 2.4.1, and virtual box. You'll need to run `export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"` to make sure that you can connect to virtual box.
## Let's get to it
To start I was getting the following error:
>default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection refused. Retrying...
I was looking high and low on why this private key that vagrant provides within itself doesn't work. It seems like with wsl you need to use port 2222 and have a plugin that does all the fun connection stuff behind the scenes. You can find the plugin details [here](https://github.com/Karandash8/virtualbox_WSL2) or just run `vagrant plugin install virtualbox_WSL2`.
I did all this and was like "ok I can finally get into this box". Wrong! Here is the new error I got.
>==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 172.17.112.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Authentication failure. Retrying...
I solved this error with the Vagrant file below. This still doesn't let me connect with the ssh key per se but I mean the password is pretty simple. Welp I got what I needed even if unclean so hope this helps you too.
## Final Nerd Detour
I didn't realize this but the folder you use to run your "app" connects to /vagrant on the box. Cool right! Here is the proof:
>==> default: Mounting shared folders...
default: /vagrant => /mnt/c/Users/orang/Documents/test-ubi
## Vagrant File
```
Vagrant.configure("2") do |config|
config.vm.box = "<box_you_want_to_use>"
config.ssh.username = 'vagrant'
config.ssh.password = 'vagrant'
config.ssh.insert_key = 'true'
end
```