Quantcast
Channel: Cheng's Blog
Viewing all articles
Browse latest Browse all 10

优化Shadowsocks速度

$
0
0

选择Ubutu 14.04版本。配置完youtube可以保证720p。

1) 更新OS:

sudo apt-get update && sudo apt-get upgrade -y

2) 安装SS

apt-get install python-pip
pip install shadowsocks

3) 创建SS的配置文件, 该文件可以放在任何地方,一般放在 /etc/ 这个文件夹下,所以执行下列命令

cd /etc
nano shadowsocks.json

在执行完nano命令后,在里面填入下列信息

{
    "server":"你的服务器IP,注意双引号",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"你随意选择一个密码,注意双引号",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": true
}

4) 安装谷歌BBR:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh
chmod +x bbr.sh
./bbr.sh

5) 更新sysctl.config文件(/etc/sysctl.conf),在底部增加下列选项:

fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_mem = 25600 51200 102400
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1

输入下列命令让上述配置生效:

sysctl -p

6) 更新rc.local 确保哪怕重启fast tcp open也有效:

nano /etc/rc.local

在文件底部加上

echo 3 > /proc/sys/net/ipv4/tcp_fastopen

7) 开启SS服务:

sudo ssserver -c /etc/shadowsocks.json -d start

如果需要关闭ss服务器:

sudo ssserver -c /etc/shadowsocks.json -d stop

Viewing all articles
Browse latest Browse all 10

Trending Articles