Skip to content

构建shadowsocks服务器访问Google等网站

确保你的主机Python版本为 2.6 or 2.7.

Ubuntu安装Python: apt-get install python

Centos安装Python: yum install python

2.7.9或更新版本的Python中,默认包含了pip,如果你的版本没有包含该命令,则需要安装pip

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
#然后用pip命令安装shadowsocks服务端
pip install shadowsocks

GIT方式安装服务端:

$ git clone https://github.com/shadowsocks/shadowsocks.git
$ cd shadowsocks
$ python setup.py

以上的两种方式安装都可以!更多安装方式:https://shadowsocks.org/en/download/servers.html 

快速配置服务端:

shadowsocks使用JSON格式的配置文件,需自己手动创建该文件!

#vim /usr/local/etc/shadowsocks.json
{
    "server":"my_server_ip",   
    "server_port":8388,   
    "local_port":1080,    
    "password":"barfoo!",
    "timeout":600,
    "method":"table"
}

Explanation of each field:
server: your hostname or server IP (IPv4/IPv6).
server_port: server port number.
local_port: local port number.
password: a password used to encrypt transfer.
timeout: connections timeout in seconds.
method: encryption method, "bf-cfb", "aes-256-cfb", "des-cfb", "rc4", etc. Default is table, which is not secure. "aes-256-cfb" is recommended.

高级配置(优化):

1. vi /etc/security/limits.conf

* soft nofile 51200
* hard nofile 51200
ulimit -n 51200

2. vim /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    配置文件生效。

客户端下载:https://shadowsocks.org/en/download/clients.html

Published in服务应用

One Comment

  1. hzp hzp

    沙发…

发表评论

电子邮件地址不会被公开。 必填项已用*标注