Vmess协议VPN搭建

Vmess协议VPN搭建

环境

  • Server Ubuntu 18.04
  • Client Windows 10 1903
  • Client ios 15.2
  • Software V2RAY 4.44.0

搭建步骤

Server配置

  1. 安装和更新 V2Ray

    1
    
    bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
    
  2. 安装最新发行的 geoip.dat 和 geosite.dat

    1
    
    bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)
    
  3. 配置config文件

    /usr/local/etc/v2ray/config.json

    需要随机获取一个uuid,用python uuid库或者uuid网站生成。

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    
    {
    "log":{
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "inbounds": [{
        "port": 填写自定义端口,
        "protocol": "vmess",
        "settings": {
        "clients": [{
            "id": "填写自定义生成的UUID",
            "alterID": 64
        }]
        },
        "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
        }
    }],
    "outbounds": [
        {
        "protocol": "freedom",
        "settings": {}
        },
        {
        "protocol": "blackhole",
        "settings": {},
        "tag": "blocked"
        }
    ],
    "routing": {
        "domainStrategy": "IPOnDemand",
        "rules": [
        {
            "type": "field",
            "ip": ["geoip:private"],
            "outboundTag": "blocked"
        },
        {
            "type": "field",
            "protocol": ["bittorrent"],
            "outboundTag": "blocked"
        }
        ]
    }
    }
    
  4. 重启服务

    systemctl restart v2ray

  5. 防护墙开放端口

    ufw allow 端口

客户端配置

  1. 下载软件

  2. 配置软件

    • 端口为服务器配置的自定义端口
    • uuid为服务器配置的自定义uuid
    • 协议vmess
  3. 连接即可。