Auto-sync: 2026-04-18 16:02

This commit is contained in:
2026-04-18 16:02:38 +08:00
parent badd1215d7
commit e7e77ae92e
55 changed files with 3026 additions and 16 deletions

View File

@@ -0,0 +1,33 @@
---
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]]
- [[代理链]]