搭建SS-libev服务端

***-libev是***众多版本中的一种,本博最为推荐。它使用libuv + C 编写,500不到的代码,资源消耗非常小,再破的VPS都能跑得起来。相对于其他版本的***,***-libev不会出现掉进程或cpu 100%的问题。
1.安装必要组建
centos执行
yum install build-essential autoconf libtool openssl-devel gcc -y
debian执行
apt-get install build-essential autoconf libtool libssl-dev gcc -y
2.安装git
centos执行
yum install git -y
debian执行
apt-get install git -y
装完了执行
git --version
如果出版本号则安装成功。
 
3.下载***-libev源码包并编译
git clone https://github.com/madeye/***-libev.git

cd ***-libev

./configure

make && make install
 
4.运行***
nohup /usr/local/bin/ss-server -s IP地址 -p 端口 -k 密码 -m 加密方式 &
比如:nohup /usr/local/bin/ss-server -s 156.132.67.213 -p 8981 -k admin888 -m aes-256-cfb &
5.加入开机启动
echo "nohup /usr/local/bin/ss-server -s IP地址 -p 端口 -k 密码 -m 加密方式 &" >> /etc/rc.local

 

【关于配置参数】

Usage:

usage:

    ss-[local|redir|server|tunnel]

          -s <server_host>           host name or ip address of your remote server
          -p <server_port>           port number of your remote server
          -l <local_port>            port number of your local server
          -k <password>              password of your remote server


          [-m <encrypt_method>]      encrypt method: table, rc4, rc4-md5
                                     aes-128-cfb, aes-192-cfb, aes-256-cfb,
                                     bf-cfb, camellia-128-cfb, camellia-192-cfb,
                                     camellia-256-cfb, cast5-cfb, des-cfb,
                                     idea-cfb, rc2-cfb and seed-cfb
          [-f <pid_file>]            file to store the pid
          [-t <timeout>]             socket timeout in seconds
          [-c <config_file>]         config file in json


          [-i <interface>]           network interface to bind,
                                     not available in redir mode
          [-b <local_address>]       local address to bind,
                                     not available in server mode
          [-u]                       enable udprelay mode
                                     not available in redir mode
          [-L <addr>:<port>]         setup a local port forwarding tunnel,
                                     only available in tunnel mode
          [-v]                       verbose mode


          [--fast-open]              enable TCP fast open,
                                     only available on Linux kernel > 3.7.0
          [--acl <acl_file>]         config file of ACL (Access Control List)

notes:

    ss-redir provides a transparent proxy function and only works on the 
    Linux platform with iptables.

 

Advanced usage:

# Create new chain
root@Wrt:~# iptables -t nat -N ***

# Ignore your *** server's addresses
# It's very IMPORTANT, just be careful.
root@Wrt:~# iptables -t nat -A *** -d 123.123.123.123 -j RETURN

# Ignore LANs and any other addresses you'd like to bypass the proxy
# See Wikipedia and RFC5735 for full list of reserved networks.
# See ashi009/bestroutetb for a highly optimized CHN route list.
root@Wrt:~# iptables -t nat -A *** -d 0.0.0.0/8 -j RETURN
root@Wrt:~# iptables -t nat -A *** -d 10.0.0.0/8 -j RETURN
root@Wrt:~# iptables -t nat -A *** -d 127.0.0.0/8 -j RETURN
root@Wrt:~# iptables -t nat -A *** -d 169.254.0.0/16 -j RETURN
root@Wrt:~# iptables -t nat -A *** -d 172.16.0.0/12 -j RETURN
root@Wrt:~# iptables -t nat -A *** -d 192.168.0.0/16 -j RETURN
root@Wrt:~# iptables -t nat -A *** -d 224.0.0.0/4 -j RETURN
root@Wrt:~# iptables -t nat -A *** -d 240.0.0.0/4 -j RETURN

# Anything else should be redirected to ***'s local port
root@Wrt:~# iptables -t nat -A *** -p tcp -j REDIRECT --to-ports 12345

# Apply the rules
root@Wrt:~# iptables -t nat -A OUTPUT -p tcp -j ***

# Start the ***-redir
root@Wrt:~# ss-redir -c /etc/config/***.json -f /var/run/***.pid

 
【关于客户端】
***的客户端现在还不太成熟,个人推荐http://sourceforge.net/projects/***/files/dist/
yingwa更方便,适合新人,但我不喜欢,似乎访问任何网站都要代理一下(只是一下),令我反感。
安卓、IOS也有客户端,我没有试过。
【关于加密方式】
如果启动命令里不写“-m aes-256-cfb”的话,则默认的加密方式为table,我也推荐使用这种加密,因为速度最快。选择aes-256-cfb则比较安全,其实对速度也几乎没有影响。
【关于更改端口、密码、加密方式】
启动命令里已经包含了这些信息,如果改了,别忘记也改一下开机启动里的。
【关于结束服务】
ps aus 会看到“/usr/local/bin/ss-server …….”的进程,kill掉即可,比如: kill 29899

原文链接:http://ippotsuko.com/blog/install-***-libev-server/

posted on 2014-09-17 21:02  wpjamer  阅读(1018)  评论(0)    收藏  举报

导航