2

The IP of my Windows 10 machine is 192.168.3.108 and the IP of my Mac is 192.168.3.100.

WSL on my Windows 10 gives this, running SSHD:

>wsl hostname -I
172.29.152.15

How can I directly SSH into the WSL on my Windows 10 machine without having to connect to the Windows 10 machine first?

with Darius' help, I tried this

netsh interface portproxy add v4tov4 listenport=22 listenaddress=0.0.0.0 connectport=22 connectaddress=192.168.3.109

My mac still cannot connect the WSL, am I using the right ports? Do I need to change something on Windows firewall?

4
  • Perhaps have a look at this blog post. It describes a process for forwarding SSH to WSL2 in Windows. Commented May 13, 2021 at 4:28
  • Microsoft has documentation on this --> docs.microsoft.com/en-us/windows/wsl/… does that work for you? The primary idea is to create a forwarding rule from external port to the WSL IP:Port combination
    – Darius
    Commented May 13, 2021 at 4:31
  • 1
    Possible duplicate of SSH the worker's WSL from the controller node's WSL and/or ssh into WSL2 works on only some IP addresses. The easiest method is to use the Windows host as the jumphost, but you say you don't want to do that. In that case, see here for more general techniques on WSL2 port forwarding. Commented May 13, 2021 at 14:40
  • "Am I using the right ports?" - Anecdotally, I have never had good luck with port 22. You might want to try setting up every everything for SSH on another port (e.g. 2222). Commented May 13, 2021 at 17:16

0

You must log in to answer this question.

Browse other questions tagged .