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

酸爽

相关推荐
cuckooman7 天前
如何升级wsl1到wsl2
wsl·wsl2
乌白云10 天前
windows11下利用wsl2安装Ubuntu-24.04
linux·ubuntu·wsl2
爱学习的程序媛11 天前
WSL2:Windows上运行Linux的完整指南
linux·运维·windows·ubuntu·wsl2
m0_6515939115 天前
WSL2固定Nacos IP访问Win10服务
wsl2·openclaw
特立独行的猫a17 天前
在 Windows 10 上安装和使用 WSL 2 安装 Ubuntu24详细指南
windows·ubuntu·wsl2
HelloTonyGo19 天前
个人游戏笔记本免费“养龙虾”(Win10+WSL2+OpenClaw 部署与配置指南)
windows·ubuntu·wsl2·openclaw
comedate20 天前
【OpenClaw】WSL2 源码安装 OpenClaw 完整指南 (20260313 版本)
wsl2·源码安装·opeclaw
haibindev1 个月前
在 Windows+WSL2 上部署 OpenClaw AI员工的实践与踩坑
linux·wsl2·openclaw
小云小白2 个月前
windows Wsl2 搭建rockyLinux podman 容器开发环境
windows·podman·wsl2
禅口魔心2 个月前
Win10 + WSL2 + Docker:K510(DongshanPI-Vision)开发环境从踩坑到跑通全记录(交叉编译 + 上板运行)
docker·嵌入式开发·wsl2·k510