使用curl命令发包,去访问外部的站点,查看响应回来的ip,就能知道本终端的ip是什么了。

xxx@xxxMacBook-Pro ~ % curl ip.sb
xxx.xxx.xxx.69

设置代理

根据自己的shell命令解释器来进修改配置,我这里举例zsh。


sudo vim ~/.zshrc

# where proxy
proxy () {
  export http_proxy="http://127.0.0.1:1087"
  export https_proxy="http://127.0.0.1:1087"
  echo "HTTP Proxy on"
}

# where noproxy
noproxy () {
  unset http_proxy
  unset https_proxy
  echo "HTTP Proxy off"
}

最后让配置生效一下:source ~/.zshrc ,然后通过在当前的终端窗口输入proxy ,noproxy 打开或者关闭代理即可。注意,需要在每个终端窗口都打开一次。

打开了代理之后,同样可以使用curl ip.sb 命令查看一下是否正常代理上了。

相关文章:

  • 2021-12-12
  • 2021-12-04
  • 2021-12-08
  • 2021-10-02
  • 2021-07-17
  • 2021-12-05
  • 2021-11-06
  • 2021-11-17
猜你喜欢
  • 2021-12-26
  • 2021-09-20
  • 2019-07-03
  • 2021-12-06
  • 2021-12-10
  • 2021-11-13
  • 2021-12-04
相关资源
相似解决方案