V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zwyyy456
V2EX  ›  宽带症候群

clash 透明代理分流与 ipv6

  •  
  •   zwyyy456 · 159 天前 · 2763 次点击
    这是一个创建于 159 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我的设备情况大致如下:红米 ac2100 刷了 padavan 作主路由,斐讯 N1 刷入了 armbian ,安装了 tpclash (可以理解为 clash.meta 内核做了一点额外配置)。

    之前主路由都是没有开启 ipv6 的,最近了解到,tailscale 打洞,如果其中一个设备有公网 ipv6 ,那么打洞成功率会很高,于是在主路由上开启了 ipv6 。

    Windows 我依旧是手动设置 ip ,Windows11 可以分别设置 ipv4 的网关、DNS 与 ipv6 的网关、DNS 。而小米手机与 iphone 设置静态 ip 时,只能指定 ipv4 的网关,dns 我也只指定了 ipv4 的 dns 。

    问题来了,当我这样设置之后,tpclash 的分流规则似乎失效了。

    请教一下 V2EX 的诸位,如果我希望 ipv6 与旁路由的 tpclash 的分流功能能够比较好的共存,应该如何实现呢?

    tpclash 的配置文件内容如下,rule 是采用 rule-provider 的方式定义的,相比完整的配置文件,忽略了 proxy-provider 的相关部分。

    mixed-port: 7890 # 局域网访问 Port
    bind-address: "*" #绑定 IP 地址
    allow-lan: true # 允许局域网访问
    mode: rule # 模式
    log-level: info # 日志等级
    external-controller: 0.0.0.0:9090 # 网页端口
    find-process-mode: strict # 匹配所有进程
    tcp-concurrent: true # tcp 并发模式
    ipv6: false #软路由上不建议开启
    
    # clash meta 内核需要关闭 iptables
    iptables:
      enable: false
    
    # ui 部分
    # secret: ""
    # external-ui: .\ui\public
    
    geodata-mode: true
    geox-url: # 自定义 geodata url, 需要有代理的前提才能下载 geoip 和 geosite
      geoip: "https://gcore.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat"
      geosite: "https://gcore.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat"
      mmdb: "https://gcore.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb"
    
    # fakeip 本地存储,省略 DNS 查询
    profile:
      store-selected: true # 存储 select 选择记录
      store-fake-ip: true # 持久化 fake-ip
    
    # Tun 配置 Windows 使用
    tun:
      enable: true
      stack: system # gvisor / lwip
      dns-hijack:
        - any:53 # 需要劫持的 DNS
      auto-route: true # 自动设置全局路由,可以自动将全局流量路由进入 tun 网卡。
      auto-detect-interface: true # 自动识别出口网卡
    
    dns:
      enable: true # 关闭将使用系统 DNS
      prefer-h3: true # 开启 DoH 支持 HTTP/3 ,将并发尝试
      listen: 0.0.0.0:1053 # 开启 DNS 服务器监听
      ipv6: false # 如果需要 ipv6 设置为 true
      default-nameserver:
        - 192.168.6.1 # 如果是 windows 或安卓客户端可使用 system ,如果是软路由填写你的光猫的 IP 地址,拨号的路由器的 IP 地址 DNS 不必关闭光猫的 ipv6 功能,openclash 运行在主路由上时填写 127.0.0.1 记住是替换,不要保留 system
        - https://223.5.5.5/dns-query?
        - https://1.12.12.12/dns-query
      enhanced-mode: fake-ip
      fake-ip-range: 198.18.0.1/16
      fake-ip-filter: #这里可以填写不使用 fakeip 的域名
        - "*.lan"
        - "*.battlenet.com.cn"
        - "*.battlenet.com"
        - "*.blzstatic.cn"
        - "*.battle.net"
        # === Linksys Wireless Router ===
        - "*.linksys.com"
        - "*.linksyssmartwifi.com"
        # === Apple Software Update Service ===
        - "swscan.apple.com"
        - "mesu.apple.com"
        # === Windows 10 Connnect Detection ===
        - "*.msftconnecttest.com"
        - "*.msftncsi.com"
        # === NTP Service ===
        - "time.*.com"
        - "time.*.gov"
        - "time.*.edu.cn"
        - "time.*.apple.com"
        - "time1.*.com"
        - "time2.*.com"
        - "time3.*.com"
        - "time4.*.com"
        - "time5.*.com"
        - "time6.*.com"
        - "time7.*.com"
        - "ntp.*.com"
        - "ntp.*.com"
        - "ntp1.*.com"
        - "ntp2.*.com"
        - "ntp3.*.com"
        - "ntp4.*.com"
        - "ntp5.*.com"
        - "ntp6.*.com"
        - "ntp7.*.com"
        - "*.time.edu.cn"
        - "*.ntp.org.cn"
        - "+.pool.ntp.org"
        - "time1.cloud.tencent.com"
        # === Music Service ===
        ## NetEase
        - "+.music.163.com"
        - "*.126.net"
        ## Baidu
        - "musicapi.taihe.com"
        - "music.taihe.com"
        ## Kugou
        - "songsearch.kugou.com"
        - "trackercdn.kugou.com"
        ## Kuwo
        - "*.kuwo.cn"
        ## JOOX
        - "api-jooxtt.sanook.com"
        - "api.joox.com"
        - "joox.com"
        ## QQ
        - "+.y.qq.com"
        - "+.music.tc.qq.com"
        - "aqqmusic.tc.qq.com"
        - "+.stream.qqmusic.qq.com"
        ## Xiami
        - "*.xiami.com"
        ## Migu
        - "+.music.migu.cn"
        # === Game Service ===
        ## Nintendo Switch
        - "+.srv.nintendo.net"
        ## Sony PlayStation
        - "+.playstation.net"
        - "+.playstation.com"
        - "+.stun.playstation.net"
        # === Other ===
        ## QQ Quick Login
        - "localhost.ptlogin2.qq.com"
        ## Golang
        - "proxy.golang.org"
        ## STUN Server
        - "stun.*.*"
        - "stun.*.*.*"
        ## Bilibili CDN
        - "*.mcdn.bilivideo.cn"
        # === Other ===
        - "*.bilibili.com"
        - "*.1huizhan.com"
        - "*.3.cn"
        - "*.300hu.com"
        - "*.360buy.cn"
        - "*.360buy.com"
        - "*.360buy.com.cn"
        - "*.360buyimg.com"
        - "*.360buyinternational.com"
        - "*.360top.com"
        - "*.jd.com"
    
      nameserver:
        - 192.168.6.1 # 如果是 windows 或安卓客户端可使用 system ,如果是软路由填写你的光猫的 IP 地址,拨号的路由器的 IP 地址 DNS 不必关闭光猫的 ipv6 功能,openclash 运行在主路由上时填写 127.0.0.1 记住是替换,不要保留 system
        # - 223.5.5.5 # default value
        # - 114.114.114.114
        - https://dns.alidns.com/dns-query#h3=true # 强制 HTTP/3 ,与 perfer-h3 无关,强制开启 DoH 的 HTTP/3 支持,若不支持将无法使用
        - https://doh.pub/dns-query
    
    
    rules:
      # 开始匹配规则
    
      ## 直连
      - RULE-SET, cndirect, DIRECT
      - RULE-SET, direct, DIRECT
      - RULE-SET, applecn, DIRECT
      - RULE-SET, applications, DIRECT
      - RULE-SET, private, DIRECT
      - RULE-SET, reject, REJECT
      - GEOSITE,cn,DIRECT
      - GEOSITE, private, DIRECT
      - GEOIP, cn, DIRECT
    
      # 代理匹配
      - DOMAIN-SUFFIX, chat1.zhile.io, openai
      - RULE-SET, gscholar, gscholar
      - RULE-SET, openai, openai
      - RULE-SET, microsoft, microsoft
      - RULE-SET, youtube, youtube
      - RULE-SET, google, google
      - RULE-SET, github, github
      - RULE-SET, apple, apple
      - RULE-SET, bili_us, bilius
      - RULE-SET, spotify, spotify
      - RULE-SET, telegram, telegram
      - RULE-SET, emby, emby
    
      - RULE-SET, gfw, PROXY
    
      - GEOSITE,geolocation-!cn,PROXY
    
      - MATCH, PROXY
    
    1 条回复    2023-12-03 20:54:45 +08:00
    pagxir
        1
    pagxir  
       159 天前
    可以同时主旁路由开启 IPv6 的,底下设备同时获得多个 IPv6 地址,然后根据需要调整默认路由优先级就可以了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2947 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:18 · PVG 23:18 · LAX 08:18 · JFK 11:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.