linux环境下设置shadowsocks+polipo全局代理

XX-NET仅仅可以是用户通过浏览器访问外面世界,而非系统全局代理,使用shadowsocks+polipo技术可使功能进一步拓展。

1、安装shadowsocks


   
   
  1. sudo apt-get install python-pip
  2. sudo pip install shadowsocks

2、创建配置文件shadowsocks.json,其中服务器地址、端口号、密码为为购买或免费使用的服务器(比如www.ishadowsocks.org)

   
   
  1. {
  2. "server": "xxxx.com",
  3. "server_port": 52239,
  4. "local_address": "127.0.0.1",
  5. "local_port": 1080,
  6. "password": "SOME_PASSWORD",
  7. "timeout": 600,
  8. "method": "aes-256-cfb",
  9. "fast_open": false
  10. }
3、启动shadowsocks
sslocal -c shadowsocks.json
   
   

4、安装polipo,进行二次转发(shadowsocks使用socks5协议通信,需搭配浏览器插件使用,若想要在系统全局使用,可使用polipo进行二次转发)
sudo apt-get install polipo
   
   

5、编辑配置文件,保存到/etc/polipo/config

   
   
  1. # This file only needs to list configuration variables that deviate
  2. # from the default values. See /usr/share/doc/polipo/examples/config.sample
  3. # and "polipo -v" for variables you can tweak and further information.
  4. logSyslog = true
  5. logFile = /var/log/polipo/polipo.log
  6. proxyAddress = "0.0.0.0"
  7. socksParentProxy = "127.0.0.1:1080"
  8. socksProxyType = socks5
  9. chunkHighMark = 50331648
  10. objectHighMark = 16384
  11. serverMaxSlots = 64
  12. serverSlots = 16
  13. serverSlots1 = 32
6、重启polipo服务
sudo service polipo restart
   
   
7、设置环境变量(可添加至~/.bashrc文件中使所有shell均可实现全局SOCKS5访问)

   
   
  1. export http_proxy="http://127.0.0.1:8123"
  2. export https_proxy="https://127.0.0.1:8123"
8、检测一下是否可以通过socks5协议获取google主页面
curl www.google.com
   
   

如果成功则说明可以访问。

9、ubuntu16.04或CentOS7环境设置开机自启动可参考如下链接:

https://blog.huihut.com/2017/08/25/LinuxInstallConfigShadowsocksClient/

猜你喜欢

转载自blog.csdn.net/Jailman/article/details/81388094