Shadowsocks 使用说明 快速搭建服务端 - jiejiebushuo/shadowsocks GitHub Wiki
一个可穿透防火墙的快速代理。
服务端
安装
Debian / Ubuntu:
apt-get install python-pip
pip install shadowsocks
CentOS:
yum install python-setuptools && easy_install pip
pip install shadowsocks
Windows:
使用
ssserver -p 443 -k password -m rc4-md5
如果要后台运行:
sudo ssserver -p 443 -k password -m rc4-md5 --user nobody -d start
如果要停止:
sudo ssserver -d stop
如果要检查日志:
sudo less /var/log/shadowsocks.log
实时检查日志:
tail -f /var/log/shadowsocks.log
用 -h
查看所有参数。你也可以使用 配置文件 进行配置。
服务器搭建
建议选择 Ubuntu 14.04 LTS 作为服务器以便使用 TCP Fast Open。除非有明确理由,不建议用对新手不友好的 CentOS。
为了更好的性能,VPS 尽量选择 XEN 或 KVM,不要使用 OpenVZ。推荐使用以下 VPS:
- Digital Ocean 自带的内核无需自己编译模块即可使用 hybla 算法
- Linode 功能强大,机房较多
客户端
在你本地的 PC 或手机上使用图形客户端。具体使用参见它们的使用说明。
文档
可以在 Wiki 里找到所有的文档。
License
Copyright 2015 clowwindy
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Bugs and Issues
You can use a configuration file instead of command line arguments.
Create a config file /etc/shadowsocks.json
.
Example:
{
"server":"0.0.0.0",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"mypassword",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}
多用户密码 Example:
{
"server":"0.0.0.0",
"local_address": "127.0.0.1",
"local_port":1080,
"port_password": {
"8388": "mypassword",
"8689": "mypassword"
},
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}
Explanation of the fields:
Name | Explanation |
---|---|
server | the address your server listens |
server_port | server port |
local_address | the address your local listens |
local_port | local port |
password | password used for encryption |
timeout | in seconds |
method | default: "aes-256-cfb", see Encryption |
fast_open | use TCP_FASTOPEN, true / false |
workers | number of workers, available on Unix/Linux |
To run in the foreground:
ssserver -c /etc/shadowsocks.json
To run in the background:
ssserver -c /etc/shadowsocks.json -d start
ssserver -c /etc/shadowsocks.json -d stop
加入开机启动
设置开机启动 在终端输入
vi /etc/rc.local
把里面最后的带有ssserver的一大段默认的代码删除掉, 再把
ssserver -c /etc/shadowsocks.json -d start
加进去, 按wq保存退出。
设置开机启动文件执行权限:
chmod +x /etc/rc.d/rc.local
centos 7 创建开机启动方式: (还有问题,勿用)
vi /usr/lib/systemd/system/shadowsocks.service
[Unit]
Description=Shadowsocks Server
After=network.target firewalld.service
[Service]
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
Restart=on-abort
PrivateTmp=true
[Install]
WantedBy=multi-user.target
更新一下systemctl缓存:
systemctl daemon-reload
启动开机启动服务
systemctl enable shadowsocks.service
systemctl --global enable shadowsocks.service
启动ss服务
systemctl start shadowsocks.service
重启ss服务
systemctl restart shadowsocks.service
停止ss服务
systemctl stop shadowsocks.service
关闭开机启动服务:
systemctl disable shadowsocks.service
查看是否设置成功开机启动:
systemctl is-enabled shadowsocks.service
查看系统日志:
journalctl -u shadowsocks.service
查看实时日志:
journalctl -u shadowsocks.service
Centos 7 防火墙放行:根据端口修改8388位置就行
firewall-cmd --zone=public --add-port=8388/tcp --permanent
重新加载防火墙配置
firewall-cmd --reload