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

酸爽

相关推荐
探模之翼14 天前
利用 Windows GPU 在 WSL2 中安装并配置 CUDA Toolkit
cuda·wsl2
大大大反派17 天前
WSL2环境下的Claude Code与lanyuncodingui安装与配置
wsl2·lanyuncodingui
Shier833_Ww1 个月前
Windows10+WSL2+Docker相关整理
docker·容器·ubuntu20.04·windows10·wsl2
Mike_6663 个月前
win10安装WSL2、Ubuntu24.04
windows·ubuntu·wsl2
YIBO04084 个月前
WSL2下Docker desktop的Cadvisor容器监控
运维·docker·容器·wsl·wsl2
西木九5 个月前
WSL2-Ubuntu22.04安装URSim5.21.3
linux·ubuntu22.04·wsl2·ur机械臂·ur10e
CAE虚拟与现实5 个月前
Ubuntu中snap
linux·运维·ubuntu·apt·wsl·wsl2·snap
CAE虚拟与现实5 个月前
修改wsl中发行版Ubuntu的主机名
linux·运维·ubuntu·wsl·wsl2·修改主机名
CAE虚拟与现实5 个月前
WSL2安装多个版本的Ubuntu
linux·运维·ubuntu·wsl·wsl2