I have a Windows 10 machine with WSL2 (running Ubuntu 22.04.1 LTS) and a Linux machine in the LAN of the Windows machine. I'm able to connect from the Windows host to the SSH server running in WSL. Now I want to connect to the WSL from the Linux machine or to the Linux machine from the WSL. Now according to this answer I ran the following command in PowerShell on my Windows system:
netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=192.168.101.100
where 192.168.101.100 is the IP of the WSL. Then how do I SSH from the Linux machine directly to WSL? I tried ssh -p 4000 windowsHost@windowsAdress but it is not working:
#ssh -vvv -p 4000 windowsHost@windowsAdress
OpenSSH_6.7p1 Debian-5+deb8u8, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to windowsAdress [windowsAdress] port 4000.
... and it is stuck there.