终端接入虚拟专用网

Mac mac

 

版权声明:转载请注明出处!!! https://blog.csdn.net/houzhiwen_yy/article/details/71081284

原理是将SS转化成http代理提供命令行终端使用。

1. privoxy安装

brew install privoxy

2. privoxy配置
打开配置文件 /usr/local/etc/privoxy/config

vim /usr/local/etc/privoxy/config

加入下面这两项配置项

listen-address 0.0.0.0:8118
forward-socks5 / localhost:1080 .

第一行设置privoxy监听任意IP地址的8118端口。第二行设置本地socks5代理客户端端口,注意不要忘了最后有一个空格和点号。

3. privoxy启动

brew services start privoxy

4. 查看是否启动成功

netstat -na | grep 8118

5. privoxy使用
在命令行终端中输入如下命令后,该终端即可使用VPN了。

export http_proxy=’http://localhost:8118
export https_proxy=’http://localhost:8118

如果不想用了取消即可

unset http_proxy
unset https_proxy

如果关闭终端窗口,功能就会失效,如果需要代理一直生效,则可以把上述两行代码添加到 ~/.bash_profile 文件最后。

vim ~/.bash_profile
export http_proxy=’http://localhost:8118
export https_proxy=’http://localhost:8118

使用配置文件生效

source ~/.bash_profile

posted @ 2020-07-17 18:43  huanghe0351  阅读(130)  评论(0)    收藏  举报