--- title: 镜像网络模式 type: concept tags: [wsl, network, windows] --- ## Definition 镜像网络模式(Mirrored Networking)是 WSL2 的网络配置选项,使 WSL2 与 Windows 共享网络堆栈,解决 NAT 模式下的代理和端口访问问题。 ## Configuration 在用户目录的 `.wslconfig` 文件中添加: ```ini [wsl2] networkingMode=mirrored dnsTunneling=true firewall=true autoProxy=true ``` ## Benefits - WSL2 可直接访问 Windows 的代理 - 解决 localhost 代理无法镜像的问题 - 无需手动配置宿主机 IP - 自动同步 Windows 的网络状态 ## Usage 配置完成后需执行 `wsl --shutdown` 使配置生效。 ## Related Concepts - [[WSL2]] - [[.wslconfig]] - [[代理链]]