VPS测评脚本

wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh && bash ZBench-CN.sh

参考

查看实时log

sudo tail -f /var/log/shadowsocks.log
sudo tail -f /var/log/v2ray/error.log
sudo tail -f /var/log/v2ray/access.log

JSON语法检测

Centos

sudo yum install jq

Debian

sudo apt-get install jq

使用命令
进入json所在文件夹后

jq . config.json

官网

Centos关闭防火墙

systemctl stop firewalld

Githbu上多功能一键脚本

wget https://raw.githubusercontent.com/oj8k/oj8k/master/oj8k && bash oj8k

秋水逸冰一键脚本

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

启动脚本后面的参数含义,从左至右依次为:启动,停止,重启,查看状态

  • Shadowsocks-Python 版
    /etc/init.d/shadowsocks-python restart | stop | start | status

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

  • Shadowsocks-Go 版
    /etc/init.d/shadowsocks-go restart | stop | start | status

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

卸载命令,如安装多个需要重复运行

./shadowsocks-all.sh uninstall

一键搭建gost

wget https://raw.githubusercontent.com/otherbanana/gost/master/gost.zip;unzip gost.zip;cd /root/gost;bash gost.sh

V2ray官方一键脚本

bash <(curl -L -s https://install.direct/go.sh)
  • 重启:service v2ray restart
  • 状态:service v2ray status
  • PS:服务器时间校准,比如你的服务器是aws美国的,但是你在中国使用v2ray,这样就会导致二者时间不一致,所以我们需要修改服务器的时间
  • 查看时间 date -R
  • 修改时间 sudo date --set="2019-06-05 19:51:41"

一键开启BBR plus

wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
  • 先安装内核,然后重启
  • 再安装模块
  • 出现删除内核的时候选择NO

SSR和V2ray共用80端口

  1. 安装秋水逸冰的ssr,80端口
  2. 安装官方v2ray,8080端口
  3. 输入命令
mv -f /etc/shadowsocks-r/config.json.back  /etc/shadowsocks-r/config.json

PS:

  • mv即move-f :force 强制的意思,如果目标文件已经存在,不会询问而直接覆盖;
  • 第一行命令的意思就是把config.json.back的内容强制覆盖config.json的内容
    cp /etc/shadowsocks-r/config.json /etc/shadowsocks-r/config.json.back
  • cp即copy
  • 第二行的命令的意思就是把config.json里面的内容复制到config.json.back
    sed -i 's/"redirect": "",/"redirect": "*:80#127.0.0.1:V2RAY窃听端口",/g' /etc/shadowsocks-r/config.json
  • 第三行的命令可能会不成功,就是在ssr配置文件里面的"redirect": ""改成
  • "redirect": "*:80#127.0.0.1:V2RAY窃听端口"
    /etc/init.d/shadowsocks-r restart

SSR单端口配置

{
    "server":"0.0.0.0",
    "server_ipv6":"::",
    "server_port":80,
    "local_address":"127.0.0.1",
    "local_port":1080,
    "password":"qwe123",
    "timeout":120,
    "method":"chacha20",
    "protocol":"auth_sha1_v4_compatible",
    "protocol_param":"",
    "obfs":"http_simple_compatible",
    "obfs_param":"",
    "redirect":"*:80#127.0.0.1:8080",
    "dns_ipv6":false,
    "fast_open":true,
    "workers":1
}

SSR多端口配置

{
    "server":"0.0.0.0",
    "server_ipv6":"::",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
    "80":"qwe123",
    "1082":"qwe123",
    "8991":"qwe123"
},
    "timeout":300,
    "method":"chacha20",
    "protocol":"auth_sha1_v4_compatible",
    "protocol_param":"",
    "obfs":"http_simple_compatible",
    "obfs_param":"",
    "redirect":"*:80#127.0.0.1:8888",
    "dns_ipv6":false,
    "fast_open":true,
    "workers":1
}

SSR多端口-单独配置加密和混淆配置

{
    "server":"0.0.0.0",
    "server_ipv6":"::",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
        "8081":{"protocol":"origin","obfs":"plain","password":"qwe123"},
        "8080":{"protocol":"auth_sha1_v4","obfs":"http_post","password":"qwe456"},
        "1082":"qwe789"},
    "timeout":120,
    "method":"chacha20",
    "protocol":"auth_aes128_md5",
    "protocol_param":"",
    "obfs":"http_simple",
    "obfs_param":"",
    "redirect":"",
    "dns_ipv6":false,
    "fast_open":true,
    "workers":1
}

参考文章

V2ray模板

{
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "port": 8080, //推荐80端口,更好地迷惑防火墙(好吧实际上并没有什么卵用
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "68b0fb83-4574-4204-8856-64c248715c97",
            "level": 1,
            "alterId": 10
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "tcpSettings": {
          "header": { // header 这一项是关于数据包伪装的设置,可自定义合理的内容,但要确保服务器与客户端一致
            "type": "http",
            "response": {
              "version": "1.1",
              "status": "200",
              "reason": "OK",
              "headers": {
                "Content-Type": ["application/octet-stream", "application/x-msdownload", "text/html", "application/x-shockwave-flash"],
                "Transfer-Encoding": ["chunked"],
                "Connection": ["keep-alive"],
                "Pragma": "no-cache"
              }
            }
          }
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "strategy": "rules",
    "settings": {
      "rules": [
        {
          "type": "field",
          "ip": [
            "geoip:private"
          ],
          "outboundTag": "blocked"
        }
      ]
    }
  }
}

V2ray国内中转模板

{
  "inbounds": [
    {
      "port": 36141, // 服务器监听端口
      "protocol": "vmess",    // 主传入协议
      "settings": {
        "clients": [
          {
            "id": "dc4e372e-539c-4f33-a5b3-4bc54ab45901",  // 用户 ID,客户端与服务器必须相同
            "alterId": 64
          }
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess",        // 出口协议
      "settings": {
        "vnext": [
          {
            "address": "159.89.208.68", // 国外服务器地址
            "port": 16823,        // 国外服务器端口
            "users": [
                {"id": "68b0fb83-4574-4204-8856-64c248715c97"} // 用户 ID,须与国外服务器端配置相同
            ]
          }
        ]
      }
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "block"
    },
    {
      "protocol": "freedom",  // 主传出协议
      "tag": "direct",
      "settings": {}
    }
  ],
  "routing": { // 路由设置
   "domainStrategy": "IPOnDemand",
    "strategy": "rules",
    "rules": [
      {
        "type": "field",      // 对于所有国内的 IP,都采用直连模式
        "ip": [
          "geoip:cn"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",  // 对于一些常见的国内网站,也使用直连模式
        "domain": [
          "geosite:cn"
        ],
        "outboundTag": "direct"
      }
    ]
  }
}

SSR和Nginx共用80端口

  • 同上修改redirect,"redirect":"*:80#127.0.0.1:1081" 1081你自己可以随便设定,不冲突就可以
  • 修改ngnix的nginx.conf文件,位置再/usr/local/nginx/conf
  • 把所以80修改为127.0.0.1:1081,例如
  • listen 80就改为listen 127.0.0.1:1081
  • 最后输入命令
    nginx -s reload
  • 重启ssr
    /etc/init.d/shadowsocks-r restart