Files
nexus/wiki/concepts/镜像网络模式.md
2026-04-18 16:02:38 +08:00

33 lines
732 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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]]
- [[代理链]]