Skip to content
Go back

WSL2网络代理设置

Published:  at  05:06 AM

我在Windows 11上安装了 wsl2,在终端中打开Ubuntu系统是,提示:

image-20250826085024047

这应该是我本地开了代理,但是在wsl中没有正确设置代理导致无法上网。

解决方法

打开代理软件,启用局域网连接,查看 wsl 使用的IP:

image-20250826085257498

image-20250826085320050

在 wsl 中修改 .bashrc 添加代理,编辑 .bashrc 在最后添加:

export http_proxy="http://172.26.224.1:7897"
export https_proxy="http://172.26.224.1:7897"

然后执行:

source ~/.bashrc

测试一下网络连接:

curl -I http://www.google.com

image-20250826085650384


Share this post on:

Next Post
如何使用 Git 子模块