1、安裝 shadowsocks 客戶端
ss 的客戶端有很多語言實現,包括 Python、Go、libev等,這裏使用廣泛的 Python 後端。
sudo apt-get update
sudo apt-get install python-pip
sudo pip install shadowsocks
(如果有安裝過pip的可以不用重新安裝pip了)
此時系統會多出來兩個程序:
/usr/bin/ssserver
/usr/bin/sslocal
ubuntu@ubuntu-System:~$ ssserver -h
usage: ssserver [OPTION]...
A fast tunnel proxy that helps you bypass firewalls.
You can supply configurations via either config file or command line arguments.
Proxy options:
-c CONFIG path to config file
-s SERVER_ADDR server address, default: 0.0.0.0
-p SERVER_PORT server port, default: 8388
-k PASSWORD password
-m METHOD encryption method, default: aes-256-cfb
-t TIMEOUT timeout in seconds, default: 300
--fast-open use TCP_FASTOPEN, requires Linux 3.7+
--workers WORKERS number of workers, available on Unix/Linux
--forbidden-ip IPLIST comma seperated IP list forbidden to connect
--manager-address ADDR optional server manager UDP address, see wiki
General options:
-h, --help show this help message and exit
-d start/stop/restart daemon mode
--pid-file PID_FILE pid file for daemon mode
--log-file LOG_FILE log file for daemon mode
--user USER username to run as
-v, -vv verbose mode
-q, -qq quiet mode, only show warnings/errors
--version show version information
Online help: <https://github.com/shadowsocks/shadowsocks>
2、配置shadowsocks
sudo gedit /etc/shadowsocks.json
然後會跳出一個文本框,粘貼以下內容
{
"server":"xx.xx.xx.xx",
"server_port":xxxx,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"xxxxxxxx",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": true,
"workers": 1
}
修改成你自己的服務器信息。保存退出。
3、啓動shadowsocks
sudo sslocal -c /etc/shadowsocks.json -d start
這樣,shadowsocks就運行了。但怎麼通過它上網呢,這就要設置瀏覽器了。下面介紹火狐和chrome瀏覽器的設置。4、火狐瀏覽器,代理設置
4.1、在 “附加組件->擴展” 中搜索foxystandard
4.2、安裝後點開首選項配置
4.3、工作模式切換爲 “使用其基於其預定義模板的代理服務器”
4.4、“代理服務器->新建代理服務器->常規->代理名稱” 代理名稱隨便寫xxx,
“->代理服務器細節” 選擇“手動配置代理服務器”,“IP” 127.0.0.1 ,“端口”:1080
選擇“socks v5”
4.5、 工作模式切換爲 “爲全部URLS啓用代理服務器xxx”,選擇“模式訂閱”,點“轉到”,“訂閱名稱”隨便寫xxx,“訂閱網址” http://www.woodbunny.com/gfwlist.txt,“添加代理服務器” xxx,“Format” AutoProxy,"Obfuscation" base64,點擊“確定”,應該提示添加成功,否則可能沒有打開sslocal。
4.6、關閉窗口,應該百度谷歌都可以上了。
5、chrome瀏覽器,代理設置
5.1、點擊瀏覽器右上角三個點,“更多工具”,"擴展程序",“獲取更多擴展程序”,搜索“proxy switchysharp”,下載安裝
5.2、然後打開 Proxy SwitchySharp 的設置,新建一個情景,命名爲 Shadowsocks,並設置好端口,模式爲 socks5 如圖:
再點切換規則,由於可能大概無法訪問 Google,我們就啓用切換規則,然後在 URL 模式裏輸入 *google* 統配好 Google 的所有域名,選擇好模式匹配爲通配符,情景模式爲 Shadowsocks
然後把在線規則列表打鉤,輸入 URL 爲:
https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt
勾選 AutoProxy 兼容列表,然後點立即更新,更新完成後保存即可,如圖:6、配置開機啓動
sudo gedit /etc/rc.local
在exit0上一行加上/usr/local/bin/sslocal -c /etc/shadowsocks.json -d start7、設置終端使用代理
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng
./configure
make
sudo make install
sudo cp ./src/proxychains.conf /etc/proxychians.conf
cd .. && rm -rf proxychains-ng
sudo gedit /etc/proxychains.conf
最後一行改爲socks5 127.0.0.1 1080 //1080端口
保存退出即可。
以後在終端要使用代理的命令就在命令的前面加上sudo proxychains4
可以終端輸入以下命令測試:
sudo proxychains4 wget http://www.google.com
如果能成功下載一個index.html文件說明已經代理成功。