Published on

v2 配置优先走ipv6

Authors

一些VPS(比如virmach)做代理访问google会出验证码。 做个分流,google走IPv6,其他走ipv4,vps本身的IP出去。

先装warp让他支持IPV6。 参考:https://p3terx.com/archives/cloudflare-warp-configuration-script.html

# 自动配置 WARP WireGuard 双栈全局网络
bash <(curl -fsSL git.io/warp.sh) d

然后修改V2RAY的配置:

{
  "inbounds": [
    {
      "port": 23333,
      "listen": "127.0.0.1",
      "protocol": "vmess",    
      "settings": {
        "clients": [
          {
            "id": "66666666-8888-7777-6666-888888888888",  
            "alterId": 64
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path":"/t00ls.kele/"
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      }
    }
  ],
  "outbounds": [
    {
      "tag":"IP4_out",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag":"IP6_out",
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIPv6"
      }
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "outboundTag": "IP6_out",
        "domain": ["geosite:netflix","geosite:google"]
      },
      {
        "type": "field",
        "outboundTag": "IP4_out",
        "network": "udp,tcp"
      }
    ]
  }
}

重启V2RAY。

IPv4 优先 编辑 /etc/gai.conf 文件,在末尾添加下面这行配置:

precedence ::ffff:0:0/96  100

IPv6 优先 编辑 /etc/gai.conf 文件,在末尾添加下面这行配置:

label 2002::/16   2

验证优先级