• 请不要在回答技术问题时复制粘贴 AI 生成的内容
leighton
V2EX  ›  程序员

WSL2 终于支持分配外部 IP 了

  •  1
     
  •   leighton · Jan 28, 2022 · 10337 views
    This topic created in 1743 days ago, the information mentioned may be changed or developed.

    一个 linux 子系统,只能从本机 windows 上通过 localhost 访问可太艹了。要经过一系列复杂的骚操作才能局域网下访问到 wsl 的特定端口。追了这个 issue 两年 https://github.com/microsoft/WSL/issues/4150 现在微软终于在 preview 版本(store 里提供)把这个问题解决了,具体看这一个 comment: https://github.com/microsoft/WSL/issues/4150#issuecomment-1018524753

    需要先给 hyper-v 配置 external switch ,注意如果你的网卡是 intel ax200 或者 ax201 ,添加 external switch 会失败,解决办法: https://pomeroy.me/2020/08/hyper-v-virtual-switch-creation-woes/#comment-411452

    17 replies  •  2022-01-31 10:52:41 +08:00
    billzhuang
    billzhuang
    Jan 28, 2022 via iPhone❤️1
    1
    intel 这两个网卡的驱动也是一言难尽
    brucmao
    brucmao
    Jan 28, 2022
    2
    window docker 容器分配外部 IP 没成功过
    Buges
    Buges
    Jan 28, 2022 via Android
    3
    @billzhuang 这和 Intel 没关系吧,无线桥接和以太网不同,本身就需要魔法( mac 地址转换 /arp 代理 /ap 模式等)。
    r6Vm94FFk9u3W6XI
    r6Vm94FFk9u3W6XI
    Jan 28, 2022
    4
    nice
    aflow
    aflow
    Jan 28, 2022❤️1
    5
    有人之前做了把 wsl2 的端口绑定到宿主机,可以看下这个
    https://github.com/CzBiX/WSLHostPatcher
    xinyewdz
    xinyewdz
    Jan 28, 2022
    6
    win11 才能更新这个版本。
    cxxlxx
    cxxlxx
    Jan 28, 2022
    7
    桥接后物理机网速太慢怎么解决的
    billzhuang
    billzhuang
    Jan 28, 2022
    8
    @Buges 这两个网卡的在非 wifi6 AP/Router 下,性能极其拉跨,所以还有魔改驱动。
    ThisDay
    ThisDay
    Jan 28, 2022 via Android
    9
    终于不用手动端口转发了吗
    PrinceofInj
    PrinceofInj
    Jan 28, 2022 via Android
    10
    我之前的笔记本是 ax201 网卡,发现的问题跟链接里的一模一样,也是得把网卡禁用在启用才能正常使用。然而我实在没想到后面的这个骚操作,我一直以为是自己的电脑操作系统问题。
    sp670
    sp670
    Jan 28, 2022
    11
    @billzhuang 愿闻其详,我就是 AX200 配 ac 的 AP ,感觉性能也是很一般,求个魔改驱动或相关文章的地址
    awsl2333
    awsl2333
    Jan 28, 2022 via iPhone
    12
    青春结束了
    ipcjs
    ipcjs
    Jan 28, 2022
    13
    wsl2 最繁琐的就是端口问题😂
    wazggcd
    wazggcd
    Jan 29, 2022 via iPhone
    14
    一直用 Nginx 代理,也可以直接从其他机器上 ssh 到 wsl2 里,挺方便
    看来以后 Nginx 可以省略了?
    billzhuang
    billzhuang
    Jan 30, 2022 via iPhone
    15
    flynaj
    flynaj
    Jan 30, 2022 via Android
    16
    wsl2 跟直接安装个虚拟机有什么区别。
    cmd666
    cmd666
    Jan 31, 2022
    17
    @flynaj 我感觉和系统集成度高,能直接在 windows 下使用 linux 的工具,很多人使用 linux 大多是使用命令行的工具,不用再虚拟机或者其他机器上安装确实方便
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2287 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 12:17 · PVG 20:17 · LAX 04:17 · JFK 07:17
    ♥ Do have faith in what you're doing.