wsl2 开启 mirror 模式, 局域网外部设备无法通过网络访问 wsl2 中开启的服务

查看 45|回复 4
作者:chaleaochexist   
[ol]
  • wsl2 中开启服务 -h 0.0.0.0
  • wsl2 可以通过 10.xx 网络访问, 也可以通过 127.xx 访问
  • windows 宿主机可以通过 127.xx 访问, 但是无法通过 10.xx 访问
  • 如果这个服务在 windows 上开启, 一切正常.
  • 和 clash 有关系吗? 不过我试过, 即使 clash 退了也白扯.
    [/ol]
    [wsl2]
    memory=10GB
    processors=4
    swap=16GB
    pageReporting=true
    localhostforwarding=true
    networkingMode=mirrored
    nestedVirtualization=false
    debugConsole=false
    dnsTunneling=true
    firewall=true
    autoProxy=true #强制 WSL 使用 Windows 的 HTTP 代理信息
    [boot]
    systemd=true
    [experimental]
    autoMemoryReclaim=gradual # 检测到空闲 CPU 使用率后自动释放缓存内存。设置 gradual 为缓慢释放,设置 dropcache 为立即释放缓存内存。
    sparseVhd=true

    WSL2, mirror, networking

  • jimages   
    你需要设置 windows 设置端口转发  在 windows 上设置,命令如下
    netsh interface portproxy add v4tov4 listenport=443 listenaddress=0.0.0.0 connectport=443 connectaddress=(wsl hostname -I)
    chaleaochexist
    OP
      
    @jimages 您的意思是说 mirrord 模式也需要端口转发是吗?
    chaleaochexist
    OP
      
    @jimages 试过了 不好用
    Alias4ck   
    开这个
    您需要登录后才可以回帖 登录 | 立即注册

    返回顶部