--- title: WSL2 启动与网络配置指南 type: source tags: [wsl, ubuntu, windows] date: 2026-04-18 --- ## Source File - [[raw/Home Office/WSL2 启动与网络配置指南.md]] ## Summary - 核心主题:WSL2 在 Windows 上的安装、配置与网络问题解决 - 问题域:WSL2 初始化、镜像网络模式、代理配置、国内镜像加速 - 方法/机制:.wslconfig 配置、代理环境变量、镜像源替换 - 结论/价值:通过镜像网络模式解决 GitHub 访问问题,使用国内镜像加速包安装 ## Key Claims - `wsl --install` 可快速安装 WSL2(默认 Ubuntu),完成后必须重启电脑 - 启用镜像网络模式(networkingMode=mirrored)是最稳妥的网络配置方案 - 通过 .wslconfig 配置 dnsTunneling、autoProxy 可实现 WSL2 与 Windows 网络堆栈共享 - 使用 mirror.ghproxy.com 镜像可解决 GitHub 访问受限问题 ## Key Quotes > "由于 WSL2 默认使用 NAT 模式,常会出现'localhost 代理无法镜像'或无法访问海外资源的情况。" — WSL2 网络配置痛点 ## Key Concepts - [[WSL2]]:Windows Subsystem for Linux 2,Windows 上的 Linux 兼容层 - [[镜像网络模式]]:WSL2 与 Windows 共享网络堆栈的配置模式 - [[.wslconfig]]:WSL2 全局配置文件,位于用户目录 - [[代理链]]:在 Linux 终端中配置 HTTP/HTTPS 代理的技术 ## Key Entities - [[Ubuntu]]:WSL2 默认安装的 Linux 发行版 - [[PowerShell]]:Windows 命令行工具,用于执行 WSL 管理命令 ## Connections - [[WSL2]] ← requires ← [[镜像网络模式]] - [[Ubuntu]] ← runs_on ← [[WSL2]] - [[家庭网络环境概览]] ← related_to ← [[WSL2]] ## Contradictions - (暂无)