Shadowsocks, a powerful tool you will need

Why shadowsocks?

You know the reason Y shadowsocks. so, Let’s get started:
But FYI, here the Offical Site and Source

VPS

First of all you may need a VPS out of the wall
There are way too many choises here:
budgetvm $25/year
bandwagonhost $3.99/year
hostdare $21/year
other Links:
YardVPS,Virpus,BuyVM,BudgetVM
bandwagonhost from laozuo
Hostdare 优惠码2017 Hostdare VPS 6折优惠
6折优惠码: WR7OHZUO22;
6折优惠码: LAOBULUO;

More prise more stable, it’s your choise

Server

There are varies way to install shadowsocks with NPM,python or you can install with source.
While I installed my server with NPM.
If you have any problem, try another way for luck.

NPM

Install Node

Debian and Ubuntu
1
2
3
4
5
6
7
8
apt-get install curl
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo apt-get install -y npm
sudo ln -s `which nodejs` /usr/bin/node
# cus node command in Debian is nodejs
# or sudo ln -s /usr/bin/nodejs /usr/bin/node
# or sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
RHEL, CentOS or Fedora
1
2
3
4
curl -sL https://rpm.nodesource.com/setup | bash -
#or you can
#yum install epel-release
yum install -y nodejs
源码安装

如果以上都不行的话,就源码安装吧。

1
2
3
4
5
6
7
yum -y install gcc make gcc-c++ openssl-devel wget
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
tar -zvxf node-v0.10.26.tar.gz
cd node-v0.10.26
make
make install
node -v

Install shadowsocks

1
npm install -g shadowsocks

Config shadowsocks

在任一目录,比如新建个/root/shadowsocks目录下创建文件config.json,这个就是ss的配置文件了。

1
2
3
4
5
6
7
8
{
"server":"198.98.117.102", //这里是你vps的ip地址
"server_port":8388, //服务器端监听端口
"local_port":1080, //客户端监听端口,这里可无视
"password":"pa$$w0rd", //连接密码,随便射一个
"timeout":600, //超时时间,默认即可
"method":"aes-256-cfb" //加密方式,建议用“aes-256-cfb”,当然你也可以选择table。。。
}

比如我的配置,大家也可以使用,就是bandwagonhost的,有时候要经常重启

1
2
3
4
5
6
7
8
9
mkdir shadowsocks && cd shadowsocks && vi config.json
{
"server":"198.71.84.181",
"server_port":8388,
"local_port":1080,
"password":"pa$$w0rd",
"timeout":600,
"method":"aes-256-cfb"
}

开机自启动
编辑vps的rc.local,加入

1
2
3
4
5
# which in CentOs
vi /etc/rc.d/rc/local
# which in Ubuntu
# vi /etc/rc.local
nohup ssserver -c /root/shadowsocks/config.json > /root/shadowsocks/log &


Python

easy way to use, Offical Site also list the way to install and windows version


Source

1
2
3
4
5
yum install git build-essential autoconf libtool openssl-devel gcc -y
git clone https://github.com/madeye/shadowsocks-libev.git
cd shadowsocks-libev
./configure
make && make install

启动

1
2
nohup /usr/local/bin/ss-server -s IP地址 -p 端口 -k 密码 -m 加密方式 &
nohup /usr/local/bin/ss-server -s 198.71.84.181 -p 8388 -k pa$$w0rd -m aes-256-cfb &

其中
-s 11.22.33.44 #指定服务器的IP地址,建议填0.0.0.0
-p 12345 #指定服务器绑定的IP地址
-k 12345678 #设置密码
-m aes-256-cfb #指定加密方式为aes-256-cfb,如果不指定,默认为table方式,加密方式不大会影响速度,但是table非常不安全。
加入开机启动:

1
echo "nohup /usr/local/bin/ss-server -s 198.71.84.181 -p 8388 -k pa$$w0rd -m aes-256-cfb &" >> /etc/rc.local

请把IP 端口 密码 加密方式改成自己设置的。
检测shadowsocks是否在运行:

1
ps -ef | grep ss-server | grep -v ps | grep -v grep

当然要开防火墙

1
2
iptables -F
iptables -A INPUT -p tcp --dport 端口 -j ACCEPT


Client

various client,
MAC推荐GoagentX,支持各种协议、PAC,直接新建一个shadowsocks代理,里面全部按照服务器的配置就好。可以全局或者规则使用了。
Windows推荐Goagent+,也是同样的配置一个shadowsocks,但是每个程序要自己去连代理,比如chrome的话要装switchysharp去连本地端口。
如果访问不了可以问我要客户端


SSR

shadowsocksR 一键安装

1
2
3
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocksR.sh
chmod +x shadowsocksR.sh
./shadowsocksR.sh 2>&1 | tee shadowsocksR.log

配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"server":"0.0.0.0",
"server_ipv6":"[::]",
"server_port":8989,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"pa$$w0rd",
"timeout":120,
"method":"aes-256-cfb",
"protocol":"origin",
"protocol_param":"",
"obfs":"plain",
"obfs_param":"",
"redirect":"",
"dns_ipv6":false,
"fast_open":false,
"workers":1
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
"server":"0.0.0.0",
"server_ipv6":"::",
"local_address":"127.0.0.1",
"local_port":1080,
"port_password":{
#纯 SS 不带混淆 端口25 密码为123456.
"25":"pa$$w0rd",
#端口443,密码pa$$w0rd ,protocol选择auth_chain_a。obfs选择tls1.2_ticket_auth,具体插件的介绍如下参考资料中
"443":{
"protocol":"auth_chain_a",
"password":"pa$$w0rd",
"obfs":"tls1.2_ticket_auth",
"obfs_param":""
},
#注意无论怎么变化,最后一个端口设置,不带逗号!
"3389":{
"protocol":"auth_aes128_md5",
"password":"pa$$w0rd",
"obfs":"tls1.2_ticket_auth",
"obfs_param":""
}#此处没有逗号!
},
"timeout":120,
#默认全局的加密方式,即上边各个端口的默认加密方式。一般为aes-256-cfb,移动设备的话,chacha20性能较好。
"method":"aes-256-cfb",
#protocol.协议定义插件的默认值,origin即使用原版SS协议,不混淆。即上面端口配置中,你没有设置 protocol 和 obfs 情况下,使用的默认值。
"protocol": "origin",
"protocol_param": "",
#protocol.协议定义插件的默认值,plain即使用原协议,不混淆。
"obfs": "plain",
"obfs_param": "",
"redirect": "",
"dns_ipv6": false,
#TCP FAST OPEN ,打开
"fast_open": true,
"workers": 1
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
"server":"0.0.0.0",
"server_ipv6":"[::]",
"local_address":"127.0.0.1",
"local_port":1080,
"port_password":{
"8989":"pa$$w0rd",
"8990":{
"password":"pa$$w0rd",
"method":"chacha20"
},
"8991":{
"password":"pa$$w0rd",
"obfs":"tls1.2_ticket_auth",
"obfs_param":"",
"method":"chacha20"
}
},
"timeout":120,
"method":"aes-256-cfb",
"protocol":"origin",
"protocol_param":"",
"obfs":"plain",
"obfs_param":"",
"redirect":"",
"dns_ipv6":false,
"fast_open":true,
"workers":1
}

参考:
Centos搭建Shadowsocks的教程,并用Chrome成功访问Google
ShadowSocks从入门到私通
Installing Node.js via package manager
VPS + Shadowsocks + COW + Ocserv + AnyConnect = 多平台翻墙解决方案
If U dont wanna deploy

Contents
  1. 1. Why shadowsocks?
    1. 1.1. VPS
    2. 1.2. Server
      1. 1.2.1. NPM
        1. 1.2.1.1. Install Node
          1. 1.2.1.1.1. Debian and Ubuntu
          2. 1.2.1.1.2. RHEL, CentOS or Fedora
          3. 1.2.1.1.3. 源码安装
        2. 1.2.1.2. Install shadowsocks
        3. 1.2.1.3. Config shadowsocks
      2. 1.2.2. Python
      3. 1.2.3. Source
    3. 1.3. Client
    4. 1.4. SSR
|