设为首页 加入收藏

TOP

Mac 终端使用VPN (已解决)
2017-10-11 14:59:50 】 浏览:2450
Tags:Mac 终端 使用 VPN 解决

原理是将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

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Linux的wget命令详解【转载】 下一篇命令行添加subl命令

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目