Linux使用V2Ray 原生客户端

jupiter
2021-10-26 / 0 评论 / 4,074 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年12月07日,已超过843天没有更新,若内容或图片失效,请留言反馈。

Linux使用V2Ray 原生客户端

1、下载二进制文件

官方下载链接:https://github.com/v2fly/v2ray-core/releases

2、配置客户端

cd ~
wget https://github.com/v2fly/v2ray-core/releases/download/v4.31.0/v2ray-linux-64.zip
unzip -d v2ray-cli v2ray-linux-64.zip
cd v2ray-cli/
chmod +x v2ray v2ctl
vim config.json

config.json 客户端配置

{
  "log": {
    "loglevel": "info"
  },
  "inbounds": [
    {
      "port": 1080,
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "udp": true // 开启 UDP 协议支持
      }
    },
    {
      "port": 10809,
      "protocol": "http",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    }
  ],
  "outbounds": [
    {
      "tag": "proxy-vmess",
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "nas.inat.top", // 服务器的 IP
            "port": 53689, // 服务器的端口
            "users": [
              {
                // id 就是 UUID,相当于用户密码
                "id": "77ba2a7d-3e1d-486c-a2f5-c8718d3d1560",
                "alterId": 10
              }
            ]
          }
        ]
      }
    },
    {
      "tag": "direct",
      "settings": {},
      "protocol": "freedom"
    }
  ],
  "dns": {
    "server": [
      "8.8.8.8",
      "1.1.1.1"
    ],
    // 你的 IP 地址,用于 DNS 解析离你最快的 CDN
    "clientIp": "202.113.37.69"
  },
  // 配置路由功能
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules": [
      {
        "type": "field",
        "domain": [
          "cnblogs.com"
        ],
        "outboundTag": "proxy-vmess"
      },
      {
        "type": "field",
        "domain": [
          "domain:inat.top"
        ],
        "outboundTag": "direct"
      }
    ]
  }
}

测试配置文件

./v2ray -test config.json

3. 启动客户端

screen -S v2ray
./v2ray -v2ray config.json

4. 测试代理

curl -x http://127.0.0.1:10809 www.baidu.com

参考资料

  1. 记录:Linux下 V2Ray 原生客户端配置
  2. 在 v2ray 中同时开启 socks 和 http 代理
0

评论 (0)

打卡
取消