Published in


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,

We SSH to that IP

Hope this help.

See you in the next article!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store