Windows 原生运行Linux如何自由访问互联网 WSL2 使用 Clash for Windows做代理 – V2方圆 (v2fy.com)
hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
alias setp='export https_proxy="http://${hostip}:7890";export http_proxy="http://${hostip}:7890";export all_proxy="socks5://${hostip}:7890";export ALL_PROXY="socks5://${hostip}:7890";'
alias unsetp='unset https_proxy; unset http_proxy; unset all_proxy; unset ALL_PROXY;'
使用时发现在执行sudo
命令时,代理失效,这是因为代理配置只对当前用户生效,若想对root用户生效,需要切换到root用户,重新设置一下。
网友评论