shadowsocks SS 翻墙 ( python , c )


python版本安装

yum install m2crypto
pip install shadowsocks
pip install git+https://github.com/shadowsocks/shadowsocks.git@master
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar zxf LATEST.tar.gz
cd libsodium*
./configure
make && make install
# 修复关联
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig

配置

单端口:
vi   /etc/ssserver.json
{
"server":"43.227.100.103",
"server_port":2626,
"password":"blizzmi.us007",
"timeout":600,
"method":"chacha20"
}
多端口:
{
    "server":"43.227.100.103",
    "port_password": {
                "2626": "blizzmi.us007",
                "2627": "bxqj"
    },
    "timeout":600,
    "method":"chacha20"
}



md5-7cdcc2883090910428e51879d59b7cf5



#vi /etc/security/limits.conf
* soft nofile 51200
* hard nofile 51200
ulimit -n 51200

#vi /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
net.ipv4.tcp_congestion_control = hybla
sysctl -p

#启动
ssserver -c /etc/ssserver.json -d start

#带日志启动
/usr/local/bin/python3.6 /usr/local/bin/ssserver -c /etc/shadowsocks-libev/ssserver.json -d start --log-file /var/log/sss.log



md5-6b72defefa6cca04675f4080ac48589d



#编译安装
yum -y install gcc automake autoconf libtool make m2crypto autoconf libtool curl curl-devel zlib-devel openssl-devel perl perl-devel cpio expat-devel gettext-devel pcre-devel asciidoc xmlto git   mbedtls-devel libsodium-devel
yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y

$ git clone https://github.com/shadowsocks/shadowsocks-libev.git
$ cd shadowsocks-libev
$ git submodule update --init
$ ./autogen.sh && ./configure && make
$ sudo make install

#rpm安装
wget https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo -P /etc/yum.repos.d/
yum install shadowsocks-libev.x86_64 -y
systemctl enable shadowsocks-libev
systemctl start shadowsocks-libev



md5-388faf5175698c6e47c7b32c0668112c



cat /etc/shadowsocks-libev/config.json 
{
    "server":"0.0.0.0",
    "server_port":2627,
    "password":"bxqj",
    "timeout":600,
    "method":"chacha20"
}



md5-cc36db4815b574636b6fe1b010e5819b



#C版本有黑名单功能:
vi all.acl
#[reject_all]
[white_list]
127.0.0.1
::1
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
0.0.0.0/0

#启动
/usr/local/bin/ss-server -u -c /etc/shadowsocks-libev/config.json -f /var/run/shadowsocks-libev.pid --acl /etc/shadowsocks-libev/all.acl