3

请教一个 WSL2 上代理的问题

 2 years ago
source link: https://www.v2ex.com/t/809967
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Windows

请教一个 WSL2 上代理的问题

  Knuth · 17 小时 25 分钟前 · 1559 次点击

因为 windows 分配给 wsl2 的 IP 是动态变化的,所以我在.bashrc 设置了如下环境变量,我想用curl cip.cc检测终端是不走代理,但返回的是国内当地的 ip 地址

export host_ip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
export https_proxy="http://${host_ip}:7890"
export http_proxy="http://${host_ip}:7890"
export all_proxy="http://${host_ip}:7890"

所以请教下大家,终端走代理的正确姿势该怎么操作呢?

第 1 条附言  ·  3 小时 31 分钟前

看大家的都推荐 tun 模式,明天尝试下,谢谢大家

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK