dalaolala/blog

安装vless协议的v2ray

dalaolala opened this issue · 4 comments

VMESS 相信大家都不陌生了,他是 V2RAY 的传输协议。
但是在 5 月 V2RAY 爆出新闻之后,很多大神们都在弄一个新的协议,最具代表的就是 VLESS 协议。

官方安装参考这里
https://github.com/v2fly/fhs-install-v2ray

安装curl

yum makecache
yum install curl

下载脚本执行

curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh
curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh
bash install-release.sh
bash install-dat-release.sh

国内服务器执行

curl -O https://raw.githubusercontent.com/dalaolala/blog/master/vvv/a.sh
curl -O https://raw.githubusercontent.com/dalaolala/blog/master/vvv/a.sh

获取一个新的uuid
https://1024tools.com/uuid 复制其中一行 uuid

进入 /usr/local/etc/v2ray/ 目录,编辑 config.json 文件 将里面全部代码改为:

{
  "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
  "inbounds": [
    {
    "port":你的端口,
      "listen": "127.0.0.1",
      "tag": "VLESS-in",
      "protocol": "VLESS",
      "settings": {
        "clients": [
          {
          "id":"你的 UUID",
            "alterId": 0
          }
        ],
            "decryption": "none"
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path":"/cs" 
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": { },
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": { },
      "tag": "blocked"
    }
  ],
  "dns": {
    "servers": [
      "https+local://1.1.1.1/dns-query",
          "1.1.1.1",
          "1.0.0.1",
          "8.8.8.8",
          "8.8.4.4",
          "localhost"
    ]
  },
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "VLESS-in"
        ],
        "outboundTag": "direct"
      }
    ]
  }
}

如果使用v2ray协议,则使用如下的配置

{
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 9000, 
    "listen": "127.0.0.1",
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "eb950add-608e-409d-937f-e797324387098b", 
          "level": 1,
          "alterId": 0 
        }
      ]
    },
   "streamSettings":{
      "network": "ws",
      "wsSettings": {
           "path": "/api"
      }
   }
  },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },
  "outboundDetour": [
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "strategy": "rules",
    "settings": {
      "rules": [
        {
          "type": "field",
          "ip": [
            "0.0.0.0/8",
            "10.0.0.0/8",
            "100.64.0.0/10",
            "127.0.0.0/8",
            "169.254.0.0/16",
            "172.16.0.0/12",
            "192.0.0.0/24",
            "192.0.2.0/24",
            "192.168.0.0/16",
            "198.18.0.0/15",
            "198.51.100.0/24",
            "203.0.113.0/24",
            "::1/128",
            "fc00::/7",
            "fe80::/10"
          ],
          "outboundTag": "blocked"
        }
      ]
    }
  }
}

参考来自
https://www.rootfw.com/posts/d2834d54.html

环境变量名不宜为 v2ray.vmess.aead.forcedv2ray_vmess_aead_forced解决

alterId都设置0就好了

参考

Jrohy/multi-v2ray#561

一键脚本参考

https://github.com/dalaolala/VMess-fAEAD-disable

nginx反向代理配置

    location /api { 
    proxy_redirect off;
    proxy_pass http://127.0.0.1:9000; 
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
   }
TCP协议可以使用下面的配置

配置来自chatpgt =-=

{
  "inbounds": [
    {
      "port": 11112, //监听端口
      "protocol": "vmess", //协议类型
      "settings": {
        "clients": [
          {
            "id": "8ef39e0e-3709-47fa-85b5-aadf69906cc9", //客户端UUID
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "tcp", //底层传输协议
        "tcpSettings": {
          "header": {
            "type": "http", //TCP头部类型,可选 http 或 srtp
            "request": {
              "version": "1.1",
              "method": "GET",
              "path": ["/go"],
              "headers": {
                "Host": ["download.windowsupdate.com"],
                "User-Agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"]
              }
            },
            "response": {
              "version": "1.1",
              "status": "200",
              "reason": "OK",
              "headers": {
                "Content-Type": ["application/octet-stream"],
                "Transfer-Encoding": ["chunked"],
                "Connection": ["keep-alive"],
                "Pragma": "no-cache"
              }
            }
          }
        }
      },
      "sniffing": {
        "enabled": true, //是否开启流量探测
        "destOverride": ["http", "tls"] //探测目的地
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}
客户端的配置参考如下

image