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

酸爽

相关推荐
全息数据2 天前
WSL2 中将 Ubuntu 20.04 升级到 22.04 的详细步骤
深度学习·ubuntu·wsl2
人工智能训练4 天前
在Windows系统Docker中使用wsl2、容器、windows文件路径三种不同挂载方式的区别和性能差异
运维·服务器·人工智能·windows·docker·容器·wsl2
C2H5OH66614 天前
Podman讲解
docker·centos·vmware·podman·wsl2·sqlbot
赴遥16 天前
WSL2下Ubuntu20.04图形化环境配置
ubuntu·wsl2·xfce4·图形化页面
赴遥17 天前
[出现错误 2147942402 (0x80070002) (启动“ubuntu2004.exe”时)]
ubuntu·win11·wsl2
习惯就好zz20 天前
WSL2 安装Ubuntu卡在安装进度0%无响应问题解决
linux·windows·ubuntu·wsl·wsl2
欧克小奥1 个月前
Win10使用WSL2安装ubuntu22.04
ubuntu·wsl2
aitav02 个月前
⚡ WSL2 搭建 s5p6818 Linux 嵌入式开发平台(part 1):环境准备与架构设计
linux·嵌入式·wsl·wsl2
探模之翼3 个月前
利用 Windows GPU 在 WSL2 中安装并配置 CUDA Toolkit
cuda·wsl2
大大大反派3 个月前
WSL2环境下的Claude Code与lanyuncodingui安装与配置
wsl2·lanyuncodingui