美文网首页
WSL2使用Windows代理

WSL2使用Windows代理

作者: Hiper | 来源:发表于2023-01-05 14:57 被阅读0次

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用户,重新设置一下。

相关文章

网友评论

      本文标题:WSL2使用Windows代理

      本文链接:https://www.haomeiwen.com/subject/jbkjcdtx.html