使用wsl宿主机网络代理,解决wsl的linux系统使用windows宿主机网络代理的问题
wsl中运行;
ip route |grep default|awk '{print $3}'
172.18.160.1
vim ~/.zshrc
,然后使用source ~/.zshrc
,7890是宿主机网络代理端口export https_proxy="http://172.18.160.1:7890"
export http_proxy="http://172.18.160.1:7890"
export all_proxy="sock5://172.18.160.1:7890"
export ALL_PROXY="sock5://172.18.160.1:7890"
vim ~/.zshrc
中写入,然后使用source ~/.zshrc
alias setp='export https_proxy="http://192.168.112.1:7890";export http_proxy="http://192.168.112.1:7890";export all_proxy="socks5://192.168.112.1:7890";export ALL_PROXY="socks5://192.168.112.1:7890";'
alias unsetp='unset https_proxy; unset http_proxy; unset all_proxy; unset ALL_PROXY;'
在终端输入setp即可开启代理, 输入unsetp 即可解除代理