Shdowsocks服务端配置
使用Python安装Shdowsocks
首先安装pip
yum install python-pip
使用pip安装shadowsocks
pip install shadowsocks
配置Shdowsocks服务,并启动用vim新建 /etc/shadowsocks.json 文件, 并写入以下内容:
单端口配置
{ “server”:”0.0.0.0″, “server_port”:443, “local_address”:”127.0.0.1″, “local_port”:1080, “password”:”your-passwd”, “timeout”:300, “method”:”aes-256-cfb”, “fast_open”:false, “workers”:5 }
多端口配置
{ “server”: “0.0.0.0”, “local_address”: “127.0.0.1”, “local_port”: 1080, “port_password”: { “123456”: “填写密码”, “123457”: “填写密码” }, “timeout”: 600, “method”: “rc4-md5” }
注意修改 password
workers 表示启动的进程数量
ssserver -c /etc/shadowsocks.json -d start #启动 ssserver -c /etc/shadowsocks.json -d stop #关闭
配置自启动
编辑shadowsocks服务的启动脚本文件,内容如下:
[Unit] Description=Shadowsocks [Service] TimeoutStartSec=0 ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json [Install] WantedBy=multi-user.target
执行以下命令启动 shadowsocks服务:
# systemctl enable shadowsocks # systemctl start shadowsocks
检查 shadowsocks 服务是否已成功启动,可以执行以下命令查看服务的状态:
# systemctl status shadowsocks -l
检查防火墙
安装无误后,若开启了防火墙,配置防火墙规则,开放你配置的端口:
# firewall-cmd –zone=public –add-port=123456/tcp –permanent # firewall-cmd –zone=public –add-port=123457/tcp –permanent # firewall-cmd –reload
使用本机Shdowsocks客户端, 连接服务端上网
下载客户端:
Windows:https://github.com/shadowsocks/shadowsocks-windows/releases
Android: https://github.com/shadowsocks/shadowsocks-android/releases
MAC: https://github.com/shadowsocks/ShadowsocksX-NG/releases
Linux: https://github.com/shadowsocks/shadowsocks-qt5/wiki/Installation
补充常用命令
start 启动
stop 停止
restart 重启
status 状态
Shadowsocks-libev 版:
/etc/init.d/shadowsocks-libev start /etc/init.d/shadowsocks-libev stop /etc/init.d/shadowsocks-libev restart /etc/init.d/shadowsocks-libev status
Shadowsocks-Python 版:
/etc/init.d/shadowsocks-python start /etc/init.d/shadowsocks-python stop /etc/init.d/shadowsocks-python restart /etc/init.d/shadowsocks-python status
ShadowsocksR 版:
/etc/init.d/shadowsocks-r start /etc/init.d/shadowsocks-r stop /etc/init.d/shadowsocks-r restart /etc/init.d/shadowsocks-r status
Shadowsocks-Go 版:
/etc/init.d/shadowsocks-go start /etc/init.d/shadowsocks-go stop /etc/init.d/shadowsocks-go restart /etc/init.d/shadowsocks-go status
如何卸载
运行如下命令,根据提示,选择对应版本卸载
./shadowsocks-all.sh uninstall
网友评论