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

酸爽

相关推荐
禅口魔心7 天前
Win10 + WSL2 + Docker:K510(DongshanPI-Vision)开发环境从踩坑到跑通全记录(交叉编译 + 上板运行)
docker·嵌入式开发·wsl2·k510
GPUStack1 个月前
GPUStack Windows(WSL2)部署指南
ai·wsl2·模型推理·gpustack·高性能推理
Nerd Nirvana2 个月前
WSL——Windows Subsystem for Linux流程一览
linux·运维·服务器·windows·嵌入式·wsl·wsl2
全息数据2 个月前
WSL2 中将 Ubuntu 20.04 升级到 22.04 的详细步骤
深度学习·ubuntu·wsl2
人工智能训练2 个月前
在Windows系统Docker中使用wsl2、容器、windows文件路径三种不同挂载方式的区别和性能差异
运维·服务器·人工智能·windows·docker·容器·wsl2
C2H5OH6663 个月前
Podman讲解
docker·centos·vmware·podman·wsl2·sqlbot
赴遥3 个月前
WSL2下Ubuntu20.04图形化环境配置
ubuntu·wsl2·xfce4·图形化页面
赴遥3 个月前
[出现错误 2147942402 (0x80070002) (启动“ubuntu2004.exe”时)]
ubuntu·win11·wsl2
习惯就好zz3 个月前
WSL2 安装Ubuntu卡在安装进度0%无响应问题解决
linux·windows·ubuntu·wsl·wsl2
欧克小奥3 个月前
Win10使用WSL2安装ubuntu22.04
ubuntu·wsl2