- 打开 Clash 的
Allow LAN
- 在
~/.bashrc
最下方添加host_ip=$(cat /etc/resolv.conf |grep "nameserver" |cut -f 2 -d " ") alias setproxy="export all_proxy=http://$host_ip:7890;export http_proxy=http://$host_ip:7890;export https_proxy=http://$host_ip:7890;" alias unsetproxy="unset all_proxy;unset http_proxy;unset https_proxy;"
- 使用
setproxy
启动代理,unsetproxy
关闭代理
参考文章 : 为 WSL2 一键设置代理