SSH to VirtualBox Port Forwarding from WSL2 Machine
Step 1 VirtualBox: Configuration of Port Forwarding
If you’re familiar with this skip to the next Section
Setting > Network > Adapter 1
Expand Advanced > Click Port Forwarding
Add the port:
- Host Port: Port you want to connect
- Guest Port: default SSH as 22
Step 2: Connect from WSL2
First, we cannot naively connect to the localhost
from WSL
The network is not mapped back like that.
We will need to find the IP of the host by
cat /etc/resolv.conf
Now we’ve got the IP, in my case, 172.29.112.1
We SSH to that IP
Hope this help.
See you in the next article!