基于v2ray的科学上网服务器搭建
@ 归零 | 星期二,六月 18 日,2019 年 | 1 分钟阅读 | 更新于 星期二,六月 18 日,2019 年

一. 服务器配置

  • 阿里云香港
  • 1Core
  • 25G
  • 限速30Mps
  • ubuntu 16.04

二. 安装步骤

1. 安装加速:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh 
chmod +x bbr.sh 
./bbr.sh

Note: 内核版本选择 4.14内核(其他内核无法启动)

2. 安装v2ray

bash <(curl -L -s https://install.direct/go.sh)

service v2ray start

3. 配置服务端(参考:https://github.com/veekxt/v2ray-template):

考虑到客户端的选择性,我这里选择tcp + shadowsocks 协议。

3.1 服务端配置

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "dns": {},
  "stats": {},
  "inbounds": [
    {
      "port": 14013,
      "protocol": "shadowsocks",
      "settings": {
        "email": "",
        "method": "aes-256-cfb",
        "password": "", ##密码
        "level": 0,
        "ota": false,
        "network": "tcp,udp"
      },
      "tag": "in-0",
      "streamSettings": {
        "network": "tcp",
        "security": "none",
        "tcpSettings": {}
      }
    }
  ],
  "outbounds": [
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "blocked",
      "protocol": "blackhole",
      "settings": {}
    }
  ],
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "ip": [
          "geoip:private"
        ],
        "outboundTag": "blocked"
      }
    ]
  },
  "policy": {},
  "reverse": {},
  "transport": {}
}

3.2 客户端配置:

{
  "log":{},
  "dns":{},
  "stats":{},
  "inbounds":[
    {
      "port":"1080",
      "protocol":"socks",
      "settings":{
        "auth":"noauth",
        "udp":true
      },
      "tag":"in-0"
    },
    {
      "port":"1081",
      "protocol":"http",
      "settings":{},
      "tag":"in-1"
    }
  ],
  "outbounds":[
    {
      "protocol":"shadowsocks",
      "settings":{
        "servers":[
          {
            "email":"",
            "address":"",
            "port":2222,
            "method":"aes-256-cfb",
            "password":"",
            "ota":false,
            "level":0
          }
        ]
      },
      "tag":"out-0",
      "streamSettings":{
        "network":"tcp",
        "security":"none",
        "tcpSettings":{}
      }
    },
    {
      "tag":"direct",
      "protocol":"freedom",
      "settings":{}
    },
    {
      "tag":"blocked",
      "protocol":"blackhole",
      "settings":{}
    }
  ],
  "routing":{
    "domainStrategy":"IPOnDemand",
    "rules":[
      {
        "type":"field",
        "ip":[
          "geoip:private"
        ],
        "outboundTag":"direct"
      }
    ]
  },
  "policy":{},
  "reverse":{},
  "transport":{}
}

© 2014 - 2022 Lionel's Blog

Powered by Hugo with theme Dream.