折腾了两个星期终于搞定了clash配置防止dns泄露的问题,附上详细的配置

Monday, Jul 8, 2024 | 7 minute read | Updated at Monday, Jul 8, 2024

@

警告,网络充满着虚假信息和极端思想,请自行加以甄别和认知,我们畅通外网,需要的是学习更多新知识,切勿以身试法

之前一直在用passwall,还是不错的,但是接触了clash后发现更优秀阿,但是真的非常难上手

使用clash功能非常强大,而且也比较稳定,特别是广告过滤,youtube直接跳过了没有什么广告等待时间了

下面是clash配置防止dns泄露的整体clash运行配置文件,注意使用的 Meta内核

下面的配置支持所有的协议比如,tuic,hysteria2等等,请修改自己的节点信息,切勿照抄。

---
port: 7890
socks-port: 7891
allow-lan: true
mode: rule
log-level: info
external-controller: 0.0.0.0:9090
dns:
  enable: true
  prefer-h3: true
  ipv6: true
  listen: 0.0.0.0:7874
  fake-ip-range: 198.18.0.1/16
  enhanced-mode: fake-ip
  fake-ip-filter:
    - "*"
    - "+.lan"
    - "+.local"

  fallback-filter:
    geoip: true
    ipcidr:
      - 240.0.0.0/4
  nameserver:
    - 114.114.114.114
    - 119.29.29.29
    - 223.5.5.5
    - https://doh.pub/dns-query
    - https://223.5.5.5/dns-query
  fallback:
    - https://dns.cloudflare.com/dns-query
   
proxies:
  - name: westnode xtls-reality
    type: vless
    server: 1.0.0.1
    port: 9093
    uuid: you-key-you-passwd
    network: tcp
    udp: true
    tls: true
    servername: addons.mozilla.org
    client-fingerprint: chrome
    reality-opts:
      public-key: you-key
      short-id: ""
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: "\U0001F1ED\U0001F1F0 香港节点"
    type: hysteria2
    server: 1.0.0.1
    ports: 50000-51000
    HopInterval: 60
    up: 200 Mbps
    down: 1000 Mbps
    password: you-key-you-passwd
    skip-cert-verify: true
  - name: "\U0001F1F9\U0001F1FC 台湾节点"
    type: tuic
    server: 1.0.0.1
    port: 9693
    uuid: you-key-you-passwd
    password: you-key-you-passwd
    alpn:
      - h3
    disable-sni: true
    reduce-rtt: true
    request-timeout: 8000
    udp-relay-mode: native
    congestion-controller: bbr
    skip-cert-verify: true
  - name: westnode trojan
    type: trojan
    server: 1.0.0.1
    port: 9699
    password: you-key-you-passwd
    client-fingerprint: random
    skip-cert-verify: true
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: westnode grpc-reality
    type: vless
    server: 1.0.0.1
    port: 9589
    uuid: you-key-you-passwd
    network: grpc
    tls: true
    udp: true
    flow:
    client-fingerprint: chrome
    servername: addons.mozilla.org
    grpc-opts:
      grpc-service-name: grpc
    reality-opts:
      public-key: you-key
      short-id: ""
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: usnode xtls-reality
    type: vless
    server: 1.1.1.1
    port: 9093
    uuid: you-key-you-passwd
    network: tcp
    udp: true
    tls: true
    servername: addons.mozilla.org
    client-fingerprint: chrome
    reality-opts:
      public-key: you-key
      short-id: ""
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: "\U0001F1EF\U0001F1F5 日本节点"
    type: hysteria2
    server: 1.1.1.1
    ports: 50000-51000
    HopInterval: 60
    up: 200 Mbps
    down: 1000 Mbps
    password: you-key-you-passwd
    skip-cert-verify: true
  - name: "\U0001F1F0\U0001F1F7 韩国节点"
    type: tuic
    server: 1.1.1.1
    port: 9693
    uuid: you-key-you-passwd
    password: you-key-you-passwd
    alpn:
      - h3
    disable-sni: true
    reduce-rtt: true
    request-timeout: 8000
    udp-relay-mode: native
    congestion-controller: bbr
    skip-cert-verify: true
  - name: usnode trojan
    type: trojan
    server: 1.1.1.1
    port: 9699
    password: you-key-you-passwd
    client-fingerprint: random
    skip-cert-verify: true
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: usnode grpc-reality
    type: vless
    server: 1.1.1.1
    port: 9589
    uuid: you-key-you-passwd
    network: grpc
    tls: true
    udp: true
    flow:
    client-fingerprint: chrome
    servername: addons.mozilla.org
    grpc-opts:
      grpc-service-name: grpc
    reality-opts:
      public-key: you-key
      short-id: ""
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: eurnode xtls-reality
    type: vless
    server: 8.8.8.8
    port: 9093
    uuid: you-key-you-passwd
    network: tcp
    udp: true
    tls: true
    servername: addons.mozilla.org
    client-fingerprint: chrome
    reality-opts:
      public-key: you-key
      short-id: ""
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: "\U0001F1F8\U0001F1EC 新加坡节点"
    type: hysteria2
    server: 8.8.8.8
    ports: 50000-51000
    HopInterval: 60
    up: 200 Mbps
    down: 1000 Mbps
    password: you-key-you-passwd
    skip-cert-verify: true
  - name: "\U0001F1FA\U0001F1F8 美国节点"
    type: tuic
    server: 8.8.8.8
    port: 9693
    uuid: you-key-you-passwd
    password: you-key-you-passwd
    alpn:
      - h3
    disable-sni: true
    reduce-rtt: true
    request-timeout: 8000
    udp-relay-mode: native
    congestion-controller: bbr
    skip-cert-verify: true
  - name: eurnode trojan
    type: trojan
    server: 8.8.8.8
    port: 9699
    password: you-key-you-passwd
    client-fingerprint: random
    skip-cert-verify: true
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
  - name: eurnode grpc-reality
    type: vless
    server: 8.8.8.8
    port: 9589
    uuid: you-key-you-passwd
    network: grpc
    tls: true
    udp: true
    flow:
    client-fingerprint: chrome
    servername: addons.mozilla.org
    grpc-opts:
      grpc-service-name: grpc
    reality-opts:
      public-key: you-key
      short-id: ""
    smux:
      enabled: true
      protocol: h2mux
      padding: true
      max-connections: "8"
      min-streams: "16"
      statistic: true
      only-tcp: false
proxy-groups:
  - name: "\U0001F680 节点选择"
    type: select
    proxies:
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1F9\U0001F1FC 台湾节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F0\U0001F1F7 韩国节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F41F 漏网之鱼"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
      - "\U0001F1F9\U0001F1FC 台湾节点"
      - "\U0001F1F0\U0001F1F7 韩国节点"
  - name: "\U0001F4C8 网络测试"
    type: select
    proxies:
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1F9\U0001F1FC 台湾节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F0\U0001F1F7 韩国节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F916 人工智能"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F3AE 游戏服务"
    type: select
    proxies:
      - "\U0001F3AF 全球直连"
      - "\U0001F680 节点选择"
  - name: "\U0001FA9F 微软服务"
    type: select
    proxies:
      - "\U0001F3AF 全球直连"
      - "\U0001F680 节点选择"
  - name: "\U0001F1EC 谷歌服务"
    type: select
    proxies:
      - "\U0001F3AF 全球直连"
      - "\U0001F680 节点选择"
  - name: "\U0001F34E 苹果服务"
    type: select
    proxies:
      - "\U0001F3AF 全球直连"
      - "\U0001F680 节点选择"
  - name: "\U0001F3A5 奈飞视频"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F4FD️ 迪士尼+"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F39E️ Max"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F3AC Prime Video"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F34E Apple TV+"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F4F9 油管视频"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F3B5 TikTok"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F4FA 哔哩哔哩"
    type: select
    proxies:
      - "\U0001F3AF 全球直连"
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F1E8\U0001F1F3 直连域名"
    type: select
    proxies:
      - DIRECT
  - name: "\U0001F1E8\U0001F1F3 直连 IP"
    type: select
    proxies:
      - DIRECT
  - name: "\U0001FA9C 代理域名"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F4F2 电报消息"
    type: select
    proxies:
      - "\U0001F680 节点选择"
      - "\U0001F1ED\U0001F1F0 香港节点"
      - "\U0001F1EF\U0001F1F5 日本节点"
      - "\U0001F1F8\U0001F1EC 新加坡节点"
      - "\U0001F1FA\U0001F1F8 美国节点"
  - name: "\U0001F5A5️ 直连软件"
    type: select
    proxies:
      - DIRECT
  - name: "\U0001F512 私有网络"
    type: select
    proxies:
      - DIRECT
  - name: "\U0001F6D1 广告拦截"
    type: select
    proxies:
      - REJECT
  - name: "\U0001F3AF 全球直连"
    type: select
    proxies:
      - DIRECT
rule-providers:
  ads:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/ads.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/ads.list
    interval: 86400
  applications:
    type: http
    behavior: classical
    format: text
    path: "./rule_provider/applications.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/applications.list
    interval: 86400
  private:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/private.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/private.list
    interval: 86400
  microsoft-cn:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/microsoft-cn.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/microsoft-cn.list
    interval: 86400
  apple-cn:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/apple-cn.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/apple-cn.list
    interval: 86400
  google-cn:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/google-cn.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/google-cn.list
    interval: 86400
  games-cn:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/games-cn.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/games-cn.list
    interval: 86400
  netflix:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/netflix.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/netflix.list
    interval: 86400
  disney:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/disney.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/disney.list
    interval: 86400
  max:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/max.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/max.list
    interval: 86400
  primevideo:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/primevideo.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/primevideo.list
    interval: 86400
  appletv:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/appletv.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/appletv.list
    interval: 86400
  youtube:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/youtube.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/youtube.list
    interval: 86400
  tiktok:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/tiktok.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/tiktok.list
    interval: 86400
  bilibili:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/bilibili.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/bilibili.list
    interval: 86400
  ai:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/ai.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/ai.list
    interval: 86400
  networktest:
    type: http
    behavior: classical
    format: text
    path: "./rule_provider/networktest.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/networktest.list
    interval: 86400
  proxy:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/proxy.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/proxy.list
    interval: 86400
  cn:
    type: http
    behavior: domain
    format: text
    path: "./rule_provider/cn.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/cn.list
    interval: 86400
  netflixip:
    type: http
    behavior: ipcidr
    format: text
    path: "./rule_provider/netflixip.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/netflixip.list
    interval: 86400
  telegramip:
    type: http
    behavior: ipcidr
    format: text
    path: "./rule_provider/telegramip.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/telegramip.list
    interval: 86400
  privateip:
    type: http
    behavior: ipcidr
    format: text
    path: "./rule_provider/privateip.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/privateip.list
    interval: 86400
  cnip:
    type: http
    behavior: ipcidr
    format: text
    path: "./rule_provider/cnip.list"
    url: https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/cnip.list
    interval: 86400
  twitter:
    type: http
    behavior: ipcidr
    format: text
    path: "./rule_provider/Twitter.list"
    url: https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list
    interval: 86400
rules:
  - DST-PORT,7895,REJECT
  - DST-PORT,7892,REJECT
  - IP-CIDR,198.18.0.1/16,REJECT,no-resolve
  - "RULE-SET,ads,\U0001F6D1 广告拦截"
  - "RULE-SET,applications,\U0001F5A5️ 直连软件"
  - "RULE-SET,private,\U0001F512 私有网络"
  - "RULE-SET,microsoft-cn,\U0001FA9F 微软服务"
  - "RULE-SET,apple-cn,\U0001F34E 苹果服务"
  - "RULE-SET,google-cn,\U0001F1EC 谷歌服务"
  - "RULE-SET,games-cn,\U0001F3AE 游戏服务"
  - "RULE-SET,netflix,\U0001F3A5 奈飞视频"
  - "RULE-SET,disney,\U0001F4FD️ 迪士尼+"
  - "RULE-SET,max,\U0001F39E️ Max"
  - "RULE-SET,primevideo,\U0001F3AC Prime Video"
  - "RULE-SET,appletv,\U0001F34E Apple TV+"
  - "RULE-SET,youtube,\U0001F4F9 油管视频"
  - "RULE-SET,tiktok,\U0001F3B5 TikTok"
  - "RULE-SET,bilibili,\U0001F4FA 哔哩哔哩"
  - "RULE-SET,ai,\U0001F916 人工智能"
  - "RULE-SET,networktest,\U0001F4C8 网络测试"
  - "RULE-SET,proxy,\U0001FA9C 代理域名"
  - "RULE-SET,cn,\U0001F1E8\U0001F1F3 直连域名,no-resolve"
  - "RULE-SET,netflixip,\U0001F3A5 奈飞视频,no-resolve"
  - "RULE-SET,telegramip,\U0001F4F2 电报消息,no-resolve"
  - "RULE-SET,privateip,\U0001F512 私有网络,no-resolve"
  - "RULE-SET,cnip,\U0001F1E8\U0001F1F3 直连 IP,no-resolve"
  - "MATCH,\U0001F680 节点选择"
redir-port: 7892
tproxy-port: 7895
mixed-port: 7893
secret: poO7lYcE
bind-address: "*"
external-ui: "/usr/share/openclash/ui"
ipv6: true
tun:
  enable: true
  stack: system
  device: utun
  auto-route: false
  auto-detect-interface: false
  dns-hijack:
    - tcp://any:53
profile:
  store-selected: true
authentication:
  - Clash:dddddddddd

警告,网络充满着虚假信息和极端思想,请自行加以甄别和认知,我们畅通外网,需要的是学习更多新知识,切勿以身试法

© 2018 - 2026 vpslala

🌱 Powered by Hugo with theme Dream.