WSL 使用经验

局域网内使用 ssh 连接 WSL2

  • 打开Windows防火墙
    • 网上搜索即可
  • 配置断开转发
## 添加规则命令
netsh interface portproxy add v4tov4 listenport=22 listenaddress=0.0.0.0 connectport=22 connectaddress=localhost

## 查看所有规则命令
netsh interface portproxy show all

## 删除规则命令
netsh interface portproxy delete v4tov4 listenport=22 listenaddress=0:0:0:0
  • 检查 WSL2 中的服务
    • 是否需要重新安装
    • 重启后是否需要单独打开
      • sudo service ssh --full-restart
posted @ 2023-04-09 19:01  bm小明  阅读(15)  评论(0编辑  收藏  举报