linux環境下設置shadowsocks+polipo全局代理

XX-NET僅僅可以是用戶通過瀏覽器訪問外面世界,而非系統全局代理,使用shadowsocks+polipo技術可使功能進一步拓展。

1、安裝shadowsocks

sudo apt-get install python-pip
sudo pip install shadowsocks

2、創建配置文件shadowsocks.json,其中服務器地址、端口號、密碼爲爲購買或免費使用的服務器(比如www.ishadowsocks.org)

{
	"server": "xxxx.com",
	"server_port": 52239,
	"local_address": "127.0.0.1",
	"local_port": 1080,
	"password": "SOME_PASSWORD",
	"timeout": 600,
	"method": "aes-256-cfb",
	"fast_open": false
}
3、啓動shadowsocks

sslocal -c shadowsocks.json

4、安裝polipo,進行二次轉發(shadowsocks使用socks5協議通信,需搭配瀏覽器插件使用,若想要在系統全局使用,可使用polipo進行二次轉發)

sudo apt-get install polipo

5、編輯配置文件,保存到/etc/polipo/config

# This file only needs to list configuration variables that deviate
# from the default values.  See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.

logSyslog = true
logFile = /var/log/polipo/polipo.log

proxyAddress = "0.0.0.0"

socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5

chunkHighMark = 50331648
objectHighMark = 16384

serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
6、重啓polipo服務

sudo service polipo restart
7、設置環境變量(可添加至~/.bashrc文件中使所有shell均可實現全局SOCKS5訪問)

export http_proxy="http://127.0.0.1:8123"
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/




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章