VPS端(服务器端设置)

安装pip

sudo yum -y install python2-pip

安装shadowsocks

pip install shadowsocks

配置shadowsocks

sudo vim /etc/shadowsocks.json

内容如下:

{
   "server":"*.*.*.*",    #输入你的SS服务器域名或IP
   "server_port":8118,    #输入你的SS服务器端口要记着客户端要用
   "local_address": "127.0.0.1",
   "local_port":1080,
   "password":"your pwd", #输入你密码别忘了客户端也要用
   "timeout":300,
   "method":"aes-256-cfb",
   "fast_open": false
}

启动脚本

sudo vim /etc/systemd/system/shadowsocks.service

内容如下

[Unit]
Description=Shadowsocks
After=network.target

[Service]
Type=forking
PIDFile=/run/shadowsocks.pid
PermissionsStartOnly=true
ExecStart=/usr/bin/ssserver --pid-file /run/shadowsocks.pid -c /etc/shadowsocks.json -d start
Restart=on-abort
User=root
Group=root
UMask=0027

[Install]
WantedBy=multi-user.target

设置开机启动

sudo systemctl enable shadowsocks
sudo systemctl start shdowsocks
sudo systemctl status shdowsocks

防火墙开放

sudo firewall-cmd --permanent --add-port=8118/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all

一个能用的SS服务器就完工了,下面只要下载相应的客户端,把参数设置一下,就能翻墙了。

代理服务器端

安装pip

sudo yum -y install python2-pip

安装shadowsocks

sudo pip install shadowsocks

配置shadowsocks

sudo vim /etc/shadowsocks.json

内容如下:

{
  "server":"*.*.*.*",        #你的SS服务器IP或域名
  "server_port":8118,        #你的SS服务器端口
  "local_address": "0.0.0.0",
  "local_port":1080,
  "password":"your pwd",     #你的SS服务器密码
  "timeout":300,
  "method":"aes-256-cfb",
  "workers": 1
}

启动脚本

sudo vim /etc/systemd/system/shadowsocks.service

内容如下:

[Unit]
Description=Shadowsocks
After=network.target

[Service]
Type=simple
User=root
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks.json

[Install]
WantedBy=multi-user.target

设置开机启动

sudo systemctl enable shadowsocks
sudo systemctl start shadowsocks
sud systemctl status shadowsocks

开放防火墙

sudo firewall-cmd --permanent --add-port=8118/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all

服务器客户端也搞好了,再配合privoxy服务器,就能代理终端翻墙,而不用在终端设备上安装SS客户端了。

Related content