IrineSistiana / mosdns

一个 DNS 转发器
GNU General Public License v3.0
2.98k stars 338 forks source link

[Bug] mosdns搭配passwall2使用时无法访问谷歌等外网 #856

Open dddd64693 opened 2 days ago

dddd64693 commented 2 days ago

在提交之前,请确认

mosdns 版本

v5.3.3-2

操作系统

Powered by LuCI istoreos-22.03 branch openwrt

Bug 描述和复现步骤

当passwall2中的dns设置为127.0.0.1:5335时,就不能再访问谷歌等需要分流的网站,但是百度等国内的就可以,远程协议中tcp,udp都试了都不行 image

image image image 日志: image 标红处是代理节点的域名,这个域名是IPv6的域名,当我换成一个直接连接IP的代理时,即能访问google,不清楚是哪边设置有问题

使用的配置文件

log:
  level: info
  file: "/var/log/mosdns.log"

# API 入口设置
api:
  http: "0.0.0.0:9091"

include: []

plugins:
  # 国内域名
  - tag: geosite_cn
    type: domain_set
    args:
      files:
        - "/var/mosdns/geosite_cn.txt"

  # 国内 IP
  - tag: geoip_cn
    type: ip_set
    args:
      files:
        - "/var/mosdns/geoip_cn.txt"

  # 国外域名
  - tag: geosite_no_cn
    type: domain_set
    args:
      files:
        - "/var/mosdns/geosite_geolocation-!cn.txt"

  # 缓存
  - tag: lazy_cache
    type: cache
    args:
      size: 20000
      lazy_cache_ttl: 86400
      dump_file: "/etc/mosdns/cache.dump"
      dump_interval: 600

  # 转发至本地服务器
  - tag: forward_local
    type: forward
    args:
      upstreams:
        - addr: "https://doh.pub/dns-query"
          bootstrap: 180.76.76.76
        - addr: 119.29.29.29

  # 转发至远程服务器
  - tag: forward_remote
    type: forward
    args:
      upstreams:
        - addr: tls://8.8.8.8
          enable_pipeline: false

  # 国内解析
  - tag: local_sequence
    type: sequence
    args:
      - exec: $forward_local

  # 国外解析
  - tag: remote_sequence
    type: sequence
    args:
      - exec: prefer_ipv4
      - exec: $forward_remote

  # 有响应终止返回
  - tag: has_resp_sequence
    type: sequence
    args:
      - matches: has_resp
        exec: accept

  # fallback 用本地服务器 sequence
  # 返回非国内 ip 则 drop_resp
  - tag: query_is_local_ip
    type: sequence
    args:
      - exec: $local_sequence
      - matches: "!resp_ip $geoip_cn"
        exec: drop_resp

  # fallback 用远程服务器 sequence
  - tag: query_is_remote
    type: sequence
    args:
      - exec: $remote_sequence

  # fallback 用远程服务器 sequence
  - tag: fallback
    type: fallback
    args:
      primary: query_is_local_ip
      secondary: query_is_remote
      threshold: 500
      always_standby: true

  # 查询国内域名
  - tag: query_is_local_domain
    type: sequence
    args:
      - matches: qname $geosite_cn
        exec: $local_sequence

  # 查询国外域名
  - tag: query_is_no_local_domain
    type: sequence
    args:
      - matches: qname $geosite_no_cn
        exec: $remote_sequence

  # 主要的运行逻辑插件
  # sequence 插件中调用的插件 tag 必须在 sequence 前定义,
  # 否则 sequence 找不到对应插件。
  - tag: main_sequence
    type: sequence
    args:
      - exec: $lazy_cache
      - exec: $query_is_local_domain
      - exec: jump has_resp_sequence
      - exec: $query_is_no_local_domain
      - exec: jump has_resp_sequence
      - exec: $fallback

  # 启动 udp 服务器。
  - tag: udp_server
    type: udp_server
    args:
      entry: main_sequence
      listen: ":5335"

  # 启动 tcp 服务器。
  - tag: tcp_server
    type: tcp_server
    args:
      entry: main_sequence
      listen: ":5335"

mosdns 的 log 记录

2024-11-16 14:07:34 WARN    forward_remote  upstream error  {"uqid": 19534, "qname": "pasyun.suancaiyu.eu.org.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "dial tcp 8.8.8.8:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    forward_remote_upstream.r0  reference query routine err {"query": {"uqid": 19534, "client": "::ffff:127.0.0.1", "qname": "pasyun.suancaiyu.eu.org.", "qtype": 1, "qclass": 1, "elapsed": "1.727500946s"}, "error": "all upstream servers failed"}
2024-11-16 14:07:34 WARN    forward_remote  upstream error  {"uqid": 19532, "qname": "pasyun.suancaiyu.eu.org.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "dial tcp 8.8.8.8:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    udp_server  entry err   {"query": {"uqid": 19532, "client": "::ffff:127.0.0.1", "qname": "pasyun.suancaiyu.eu.org.", "qtype": 1, "qclass": 1, "elapsed": "1.745931369s"}, "error": "all upstream servers failed"}
2024-11-16 14:07:34 WARN    forward_remote  upstream error  {"uqid": 19534, "qname": "pasyun.suancaiyu.eu.org.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "dial tcp 8.8.8.8:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    udp_server  entry err   {"query": {"uqid": 19534, "client": "::ffff:127.0.0.1", "qname": "pasyun.suancaiyu.eu.org.", "qtype": 28, "qclass": 1, "elapsed": "1.727982822s"}, "error": "all upstream servers failed"}
2024-11-16 14:07:34 WARN    forward_remote  failed to dial dns conn {"error": "dial tcp 1.1.1.1:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    forward_remote  upstream error  {"uqid": 19542, "qname": "disc601.prod.do.dsp.mp.microsoft.com.", "qclass": 1, "qtype": 1, "upstream": "tls://1.1.1.1", "error": "dial tcp 1.1.1.1:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    udp_server  entry err   {"query": {"uqid": 19542, "client": "::ffff:127.0.0.1", "qname": "disc601.prod.do.dsp.mp.microsoft.com.", "qtype": 1, "qclass": 1, "elapsed": "8.183928ms"}, "error": "all upstream servers failed"}
2024-11-16 14:07:34 WARN    forward_remote  failed to dial dns conn {"error": "dial tcp 8.8.8.8:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    forward_remote  upstream error  {"uqid": 19543, "qname": "edge.microsoft.com.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "dial tcp 8.8.8.8:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    forward_remote  failed to dial dns conn {"error": "dial tcp 8.8.8.8:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    forward_remote  upstream error  {"uqid": 19543, "qname": "edge.microsoft.com.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "dial tcp 8.8.8.8:853: connect: connection refused"}
2024-11-16 14:07:34 WARN    forward_remote_upstream.r0  reference query routine err {"query": {"uqid": 19543, "client": "::ffff:127.0.0.1", "qname": "edge.microsoft.com.", "qtype": 1, "qclass": 1, "elapsed": "2.847272ms"}, "error": "all upstream servers failed"}
2024-11-16 14:07:34 WARN    udp_server  entry err   {"query": {"uqid": 19543, "client": "::ffff:127.0.0.1", "qname": "edge.microsoft.com.", "qtype": 28, "qclass": 1, "elapsed": "2.967888ms"}, "error": "all upstream servers failed"}
2024-11-16 14:09:34 WARN    signal received {"signal": "terminated"}
ZhongMoDao commented 2 days ago

遇到同样问题