Docker 安装(建议)

安装 Docker 后, 执行:

docker run -dt --name ss -p 18888:18888 -p 1080:1080/udp mritd/shadowsocks -s "-s :: -s 0.0.0.0 -p 18888 -m aes-256-cfb -k 密码xxxx --fast-open" -k "-t 127.0.0.1:18888 -l :1080 -mode fast2" -x

其中 18888 端口为对外的端口,密码 密码xxxx,加密方式 aes-256-cfb

裸机安装常规做法

服务器端搭建(您可以忽视这个)

用户只需安装客户端, 不需要安装服务器端.

一登陆进终端, 我就开始:

pip install shadowsocks

好的, 我们再来:

vim /etc/sysctl.d/local.conf

增加

# max open files
fs.file-max = 51200
# max read buffer
net.core.rmem_max = 67108864
# max write buffer
net.core.wmem_max = 67108864
# default read buffer
net.core.rmem_default = 65536
# default write buffer
net.core.wmem_default = 65536
# max processor input queue
net.core.netdev_max_backlog = 4096
# max backlog
net.core.somaxconn = 4096

# resist SYN flood attacks
net.ipv4.tcp_syncookies = 1
# reuse timewait sockets when safe
net.ipv4.tcp_tw_reuse = 1
# turn off fast timewait sockets recycling
net.ipv4.tcp_tw_recycle = 0
# short FIN timeout
net.ipv4.tcp_fin_timeout = 30
# short keepalive time
net.ipv4.tcp_keepalive_time = 1200
# outbound port range
net.ipv4.ip_local_port_range = 10000 65000
# max SYN backlog
net.ipv4.tcp_max_syn_backlog = 4096
# max timewait sockets held by system simultaneously
net.ipv4.tcp_max_tw_buckets = 5000
# turn on TCP Fast Open on both client and server side
net.ipv4.tcp_fastopen = 3
# TCP receive buffer
net.ipv4.tcp_rmem = 4096 87380 67108864
# TCP write buffer
net.ipv4.tcp_wmem = 4096 65536 67108864
# turn on path MTU discovery
net.ipv4.tcp_mtu_probing = 1

# for high-latency network
net.ipv4.tcp_congestion_control = hybla

# for low-latency network, use cubic instead
# net.ipv4.tcp_congestion_control = cubic

生效:

sysctl --system

新建/root/c.json

{
    "server":"0.0.0.0",
    "server_port":18888,
    "local_address": "127.0.0.1",
    "local_port":18888,
    "password":"密码xxxx",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": true
}

前台试跑:

ssserver -c /root/c.json

后台跑和停止:

ssserver -c /root/c.json -d start
ssserver -c /root/c.json -d stop

我选择:

ssserver -c /root/c.json -d start

# 看看日志
tail -f -n 10 /var/log/shadowsocks.log

这样, 你就可以访问您的ip:18888, 密码:密码xxxx 去合理上网了。记得打开阿里巴巴的安全组!

客户端搭建

Windows 桌面系统

到这里下载: https://github.com/shadowsocks/shadowsocks-windows/releases

Mac 桌面系统

到这里下载: https://github.com/shadowsocks/ShadowsocksX-NG/releases

Android 手机系统

到这里下载:https://github.com/shadowsocks/shadowsocks-android/releases

IOS 手机系统

到这里下载:https://github.com/Jigsaw-Code/outline-client/releases

可以下载 Outline-Client.ipa,当然其他系统的安装包也可以下载。

其他方式

Linux客户端请这样:

sudo pip install shadowsocks
sslocal -s 服务器域名或IP -p 18888 -k "密码xxxx" -l 1080 -t 600 -m rc4-md5