Neilpang / wgcf-docker

CloudFlare warp in docker
143 stars 40 forks source link

大佬,问个问题,为什么IPV6不能用呢?请大佬帮忙看看哪里出错了? #7

Closed lhbdhr closed 1 year ago

lhbdhr commented 1 year ago

xray 设置了 wireguard outbounds,路由里写了 ip.gs 走wireguard,ip.gs网站可以正确显示cloudflare的IPV4地址,但是IPV6显示结果是 Not Supported

对了,补充一条信息,使用curl测试ipv6可用。但是访问 纯ipv6站点ip6only.me,不能访问。 也就是说,wgcf获取到了cloudflare的IPV6,但不知为何xray就是不用,很无奈。

docker run --rm  -it  --network container:wgcf  curlimages/curl curl 6.ipw.cn
2a09:xxxxxxxxxxxxxxxxxxxxxxxx
version: '3.9'

services:
  xray:
    image: teddysun/xray
    container_name: xray
    restart: unless-stopped
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 443:443
    volumes:
      - $PWD/config.json:/etc/xray/config.json
      - $PWD/logs:/etc/xray/logs/
  wgcf:
    image: neilpang/wgcf-docker:alpine
    container_name: wgcf
    restart: unless-stopped
    privileged: true
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
    cap_add:
      - NET_ADMIN
    volumes:
      - /lib/modules:/lib/modules
      - $PWD/wgcf:/wgcf
    networks:
      - default

networks:
  default:
    enable_ipv6: true
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: fd01:3200:3200::/64
          gateway: fd01:3200:3200::1
{
  "log": {
    "loglevel": "error",
    "access": "/etc/xray/logs/access.log",
    "error": "/etc/xray/logs/error.log",
    "dnsLog": true
  },
  "inbounds": [
    {
      "listen": null,
      "port": 443,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "XXXXXXXXXXXXXXXXXXXXXXXX",
            "email": "xxxxxxxxxx@xxxx.com",
            "flow": "xtls-rprx-vision"
          }
        ],
        "decryption": "none",
        "fallbacks": []
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "show": false,
          "dest": "www.microsoft.com:443",
          "xver": 0,
          "serverNames": [
            "www.microsoft.com",
            "wwwqa.microsoft.com",
            "staticview.microsoft.com",
            "privacy.microsoft.com"
          ],
          "privateKey": "XXXXXXXXXXXXXXXXXXXXXXX",
          "publicKey": "XXXXXXXXXXXXXXXXXXXXXX",
          "minClient": "",
          "maxClient": "",
          "maxTimediff": 0,
          "shortIds": [""]
        },
        "tcpSettings": {
          "header": {
            "type": "none"
          },
          "acceptProxyProtocol": false
        }
      },
      "tag": "inbound-443",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      }
    }
  ],
  "outbounds": [
    { "protocol": "freedom", "tag": "freedom" },
    {
      "protocol": "freedom",
      "tag": "IP6_out",
      "settings": {
        "domainStrategy": "UseIPv6"
      }
    },
    {
      "protocol": "wireguard",
      "settings": {
        "secretKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "address": ["172.18.0.3/32", "fd01:3200:3200::3/128"],
        "peers": [
          {
            "publicKey": "XXXXXXXXXXXXXXXXXXXXXXXXX",
            "allowedIPs": ["0.0.0.0/0", "::/0"],
            "endpoint": "engage.cloudflareclient.com:2408"
          }
        ],
        "reserved": [0, 0, 0],
        "mtu": 1280
      },
      "tag": "wireguard-wgcf"
    }
  ],
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "outboundTag": "IP6_out",
        "domain": ["geosite:netflix"]
      },
      {
        "type": "field",
        "domain": [
          "domain:googleapis.cn",
          "geosite:openai",
          "geosite:cn",
          "domain:ip.gs",
          "domain:ip6only.me",
          "domain:he.net",
          "domain:ipv6-test.com"
        ],
        "outboundTag": "wireguard-wgcf"
      },
      {
        "type": "field",
        "ip": ["geoip:cn"],
        "outboundTag": "wireguard-wgcf"
      }
    ]
  }
}
lhbdhr commented 1 year ago

问题解决了,address填错了。 "address": ["172.18.0.3/32", "fd01:3200:3200::3/128"],
这里我填写的是docker给wgcf容器分配的IP,应该填写wgcf生成的网卡的IP。 即使xray容器里ping不通 wgcf 添加的网卡IP,xray配置文件也要填写这个。 我不理解,但我大受震撼。