wsl2配置代理

wsl1中主机和wsl共享网络,但在wsl2中是单独的网络。
可以借助如下命令配置代理(可写在~/.profile里)

1
2
3
4
5
6
7
8
9
10
11
host_ip=$(cat /etc/resolv.conf |grep "nameserver" |cut -f 2 -d " ")

# system proxy
export ALL_PROXY="http://$host_ip:10809"

# go proxy
GOPROXY="https://goproxy.cn,direct"

# git proxy
git config --global http.proxy socks5://$host_ip:10808
git config --global https.proxy socks5://$host_ip:10808

记得打开代理软件的接受来自局域网的连接

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

请我喝杯咖啡吧~

支付宝
微信