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?

JJJohn
  • 425
  • 1
  • 10
  • 25
  • Perhaps have a look at this [blog post](https://www.hanselman.com/blog/how-to-ssh-into-wsl2-on-windows-10-from-an-external-machine). It describes a process for forwarding SSH to WSL2 in Windows. – Anaksunaman May 13 '21 at 04:28
  • Microsoft has documentation on this --> https://docs.microsoft.com/en-us/windows/wsl/compare-versions#accessing-a-wsl-2-distribution-from-your-local-area-network-lan does that work for you? The primary idea is to create a forwarding rule from external port to the WSL IP:Port combination – Darius May 13 '21 at 04:31
  • 1
    Possible duplicate of [SSH the worker's WSL from the controller node's WSL](https://superuser.com/questions/1622581/ssh-the-workers-wsl-from-the-controller-nodes-wsl) and/or [ssh into WSL2 works on only some IP addresses](https://superuser.com/q/1646999/1210833). 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](https://superuser.com/q/1618337/1210833) for more general techniques on WSL2 port forwarding. – NotTheDr01ds May 13 '21 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). – Anaksunaman May 13 '21 at 17:16

0 Answers0