wsl2 不能联网

wsl2 安装后用 wifi 共享是能联网,问题出在公司网络限制 wsl2 IP 访问网络,但是主机可以上网。

解决办法,在主机用 nginx 设置代理,可能需要开端口权限

复制代码
server {
    listen       9000;
    server_name  localhost;
    
    location /ubuntu/ {
        # 阿里源镜像地址
        proxy_pass https://mirrors.aliyun.com/ubuntu/; # 前端地址和端口
    }
    
}

/etc/apt/sources.list

复制代码
# 阿里源镜像地址
deb http://192.168.5.116:9000/ubuntu/ focal main restricted universe multiverse
deb http://192.168.5.116:9000/ubuntu/ focal-security main restricted universe multiverse
deb http://192.168.5.116:9000/ubuntu/ focal-updates main restricted universe multiverse
deb http://192.168.5.116:9000/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://192.168.5.116:9000/ubuntu/ focal main restricted universe multiverse
deb-src http://192.168.5.116:9000/ubuntu/ focal-security main restricted universe multiverse
deb-src http://192.168.5.116:9000/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://192.168.5.116:9000/ubuntu/ focal-backports main restricted universe multiverse

sudo apt update

酸爽

相关推荐
cv魔法师5 天前
WSL2 中使用 AMD Radeon 780M 核显配置 Vulkan
amd·wsl2·vulkan
Zhibang Yue11 天前
Windows下安装FreeSurfer(2026最新)
windows·wsl2·freesurfer
comedate14 天前
[WSL2] 解决 WSL2 中 Docker 部署的 SearXNG 重启后,localhost 不能用的问题
docker·wsl2·searxng
m0_5358175517 天前
Claude Code在Linux/WSL2环境完整部署指南:API中转+避坑配置一篇搞定
linux·服务器·node.js·claude·wsl2·claudecode·88api
月走乂山18 天前
Windows 10 WSL2 安装问题排查与解决全记录
windows·docker·hyper-v·故障排查·wsl2
tkevinjd1 个月前
wsl2安装
linux·wsl·虚拟机·wsl2
ChaITSimpleLove1 个月前
优化 WSL2 性能:为 Docker 和 K8s 定制高效内存配置指南
docker·容器·性能优化·kubernetes·wsl2·windows开发·pwsh
cuckooman2 个月前
如何升级wsl1到wsl2
wsl·wsl2
乌白云2 个月前
windows11下利用wsl2安装Ubuntu-24.04
linux·ubuntu·wsl2
爱学习的程序媛2 个月前
WSL2:Windows上运行Linux的完整指南
linux·运维·windows·ubuntu·wsl2