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

酸爽

相关推荐
YIBO040824 天前
WSL2下Docker desktop的Cadvisor容器监控
运维·docker·容器·wsl·wsl2
西木九1 个月前
WSL2-Ubuntu22.04安装URSim5.21.3
linux·ubuntu22.04·wsl2·ur机械臂·ur10e
CAE虚拟与现实1 个月前
Ubuntu中snap
linux·运维·ubuntu·apt·wsl·wsl2·snap
CAE虚拟与现实1 个月前
修改wsl中发行版Ubuntu的主机名
linux·运维·ubuntu·wsl·wsl2·修改主机名
CAE虚拟与现实1 个月前
WSL2安装多个版本的Ubuntu
linux·运维·ubuntu·wsl·wsl2
musk12122 个月前
YOLO环境搭建,win11+wsl2+ubuntu24+cuda12.6+idea
yolo·cuda·wsl2
浪淘沙jkp2 个月前
在线教育网站项目第四步:deepseek骗我, WSL2不能创建两个独立的Ubuntu,但我们能实现实例互访及外部访问
运维·服务器·ubuntu·wsl2·视频教育网
Shine.Zhang5 个月前
wsl2子系统ubuntu发行版位置迁移步骤
ubuntu·wsl2
梦想画家6 个月前
在WSL 2 (Ubuntu 22.04)安装Docker Ce 启动错误解决
linux·ubuntu·docker·wsl2