1. 服务端安装
apt-get install python-pip pip install shadowsocks
yum install python-setuptools && easy_install pip pip install shadowsocks
ssserver -p 8000 -k password -m rc4-md5 -d start
etc/shadowsocks.json
文件,填入如下内容:{ "server":"my_server_ip", "server_port":8000, "local_address": "127.0.0.1", "local_port":1080, "password":"mypassword", "timeout":300, "method":"rc4-md5" }
ssserver -c /etc/shadowsocks.json -d start
start
改成stop
。rc4-md5
,因为 RC4 比 AES 速度快好几倍,如果用在路由器上会带来显著性能提升。旧的 RC4 加密之所以不安全是因为 Shadowsocks 在每个连接上重复使用 key,没有使用 IV。现在已经重新正确实现,可以放心使用。更多可以看 issue1。2. 客户端安装
3. 加速优化
3.1 内核参数优化
limits.conf
vi /etc/security/limits.conf
* soft nofile 51200 * hard nofile 51200
ulimit -n 51200
修改配置文件
/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_rmem = 4096 87380 67108864 net.ipv4.tcp_wmem = 4096 65536 67108864 net.ipv4.tcp_mtu_probing = 1 net.ipv4.tcp_congestion_control = hybla
sysctl -p
使配置生效3.2 锐速
wget http://my.serverspeeder.com/d/ls/serverSpeederInstaller.tar.gz tar xzvf serverSpeederInstaller.tar.gz bash serverSpeederInstaller.sh
最后两项输入 y 开机自动启动锐速,y 立刻启动锐速。之后可以通过
lsmod
查看是否有appex模块在运行。vi /serverspeeder/etc/config
rsc="1" #RSC网卡驱动模式 advinacc="1" #流量方向加速 maxmode="1" #最大传输模式
rsc="1"
,gso="1"
。service serverSpeeder restart
3.3 net-speeder
apt-get install libnet1 apt-get install libpcap0.8 apt-get install libnet1-dev apt-get install libpcap0.8-dev
需要配置 epel 第三方源。下载 epel :http://dl.fedoraproject.org/pub/epel/ 。例如,Centos 7 x64:
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm rpm -ivh epel-release-7-5.noarch.rpm yum repolist
yum install libnet libpcap libnet-devel libpcap-devel
wget http://net-speeder.googlecode.com/files/net_speeder-v0.1.tar.gz tar zxvf net_speeder-v0.1.tar.gz cd net_speeder chmod 777 * sh build.sh -DCOOKED
./net_speeder eth0 "ip"
killall net_speeder
来自https://coderq.com/t/ke-xue-shang-wang-zhi-shadowsocks-an-zhuang-ji-you-hua-jia-su/1210