wsl 魔法
打开魔法工具的lan,记住上面的端口(我这里是7890
C:\Users<UserName>.wslconfig
[wsl2]
dnsTunneling=false
然后进入wsl
nano ~/.bashrc
在最后加入
host_ip=$(cat /etc/resolv.conf |grep "nameserver" |cut -f 2 -d " ")
export http_proxy="http://$host_ip:[端口]"
export https_proxy="http://$host_ip:[端口]"
刷环境
source ~/.bashrc
sudo visudo
Ubuntu 22.04的话,取消这行的注释
测试一下
wget www.google.com
参考:
https://blog.east.monster/2022/10/05/clash-config-in-wsl/#1-Clash-%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%86%85%E7%9A%84%E6%93%8D%E4%BD%9C