WSL2 

sudo apt-get remove --purge openssh-server
sudo apt-get update
sudo apt-get install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh

systemctl status sshd # Check SSH status
hostname -I # IP address of the WSL

 

Windows

netsh interface portproxy add v4tov4 `
  listenaddress=192.168.0.14 ` # Internal addr of the windows
  listenport=222 ` # An arbitrary port number
  connectaddress=172.20.18.135 ` # IP addrs of the WSL
  connectport=22 # The port number of WSL ssh

Additionally, you must add a new firewall inbound rule for port 222.

 

Router(iptime)

- Port forwarding (external port) 222 -> 192.168.0.14 / (internal port) 222

 

 

+ Recent posts

hihihello