日度归档:2019-02-05

Shadowsocks 相关

前言

乙亥猪年第一天,发现SSR的IP好像被封了,VPS的IP可以ping通,也可以用SSH连接上。但是使用SSR提示ERR_SOCKS_CONNECTION_FAILED,而且使用IP查询,也无法获得有效的翻墙IP。

所以将Vultr上的VPS,take snapshot,并在sydney选了一个$3.5/mo的进行了restore。

目前使用的安装脚本是 秋水逸冰 大神的 Shadowsocks 一键安装脚本(四合一)

包含一键安装 Shadowsocks-Python, ShadowsocksR, Shadowsocks-Go, Shadowsocks-libev 版(四选一)服务端。
支持以多次运行来安装多个版本,且各个版本可以共存(注意端口号需设成不同)。

安装方法

使用root用户登录,运行以下代码

wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh
chmod +x shadowsocks-all.sh
./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log

安装完成后,提示

Congratulations, your_shadowsocks_version install completed!
Your Server IP        :your_server_ip
Your Server Port      :your_server_port
Your Password         :your_password
Your Encryption Method:your_encryption_method

Your QR Code: (For Shadowsocks Windows, OSX, Android and iOS clients)
 ss://your_encryption_method:your_password@your_server_ip:your_server_port
Your QR Code has been saved as a PNG file path:
 your_path.png

Welcome to visit:https://teddysun.com/486.html
Enjoy it!

卸载方法

若已安装多个版本,则卸载时也需多次运行(每次卸载一种);

./shadowsocks-all.sh uninstall

使用方法

分别对应各版本:启动,停止,重启,查看状态。

/etc/init.d/shadowsocks-python start | stop | restart | status

/etc/init.d/shadowsocks-r start | stop | restart | status

/etc/init.d/shadowsocks-go start | stop | restart | status

/etc/init.d/shadowsocks-libev start | stop | restart | status

各版本默认配置文件的位置

/etc/shadowsocks-python/config.json

/etc/shadowsocks-r/config.json

/etc/shadowsocks-go/config.json

/etc/shadowsocks-libev/config.json

开启多端口的方法

python版、R版和Go版,分别修改对应默认配置文件,并重启即可。
配置文件示例如下:

#python版
{
    "server":"0.0.0.0",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
         "9000":"password0",
         "9001":"password1",
         "9002":"password2",
         "9003":"password3",
         "9004":"password4"
    },
    "timeout":300,
    "method":"your_encryption_method",
    "fast_open": false
}

R版
{
    "server":"0.0.0.0",
    "server_ipv6": "[::]",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
        "9000":"password0",
        "9001":"password1",
        "9002":"password2",
        "9003":"password3",
        "9004":"password4"
    },
    "timeout":300,
    "method":"your_encryption_method",
    "protocol": "your_protocol",
    "protocol_param": "",
    "obfs": "your_obfs",
    "obfs_param": "",
    "redirect": "",
    "dns_ipv6": false,
    "fast_open": false,
    "workers": 1
}

Go版
{
    "port_password":{
         "9000":"password0",
         "9001":"password1",
         "9002":"password2",
         "9003":"password3",
         "9004":"password4"
    },
    "method":"your_encryption_method",
    "timeout":300
}

libev版开启多端口的步骤如下:
1. 下载脚本并赋予权限

wget -O /etc/init.d/shadowsocks-manager https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-manager
chmod 755 /etc/init.d/shadowsocks-manager
  1. 新建配置存放目录
mkdir /etc/shadowsocks-manager
  1. 创建多端口配置文件 /etc/shadowsocks-manager/config.json 示例
{
    "server":"0.0.0.0",
    "port_password":{
         "9000":"password0",
         "9001":"password1",
         "9002":"password2",
         "9003":"password3",
         "9004":"password4"
    },
    "timeout":300,
    "user":"nobody",
    "method":"your_encryption_method",
    "nameserver":"8.8.8.8",
    "mode":"tcp_and_udp"
}

其他

以前用过一个带有多用户管理的SSR脚本感觉很好,换了VPS后,提示安装不成功。脚本来自都比根据地(doubi.io),可以最近主站上不去了,站长也不见了。

找到了几个粉丝做的备份:
1. 逗比云
2. 逗比根据地backup

参考:

  1. Shadowsocks 一键安装脚本(四合一)
  2. 如何启用 Shadowsocks 的多端口
  3. 自建ss服务器教程 Alvin9999