添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

[Bug] passwall(4.77-6 最新版)加luci-app-mosdns会导致无法访问海外 #824

Closed
@kylongteng

Description

在提交之前,请确认

  • 我已经尝试搜索过 Issue ,但没有找到相关问题。
  • 我正在使用最新的 mosdns 版本(或者最新的 commit),问题依旧存在。
  • 我仔细看过 wiki 后仍然无法自行解决该问题。
  • 我非常确定这是 mosdns 核心的问题。(如果是通过第三方衍生软件使用 mosdns 核心,不确定问题源头时,请先向衍生软件开发者提交问题。)
  • mosdns 版本

    v5.3.1

    openwrt

    Bug 描述和复现步骤

    Bug: passwall(4.77-6 最新版)加luci-app-mosdns会导致无法访问海外。不确定是mosdns还是luci-app-mosdns的问题,所以两边都发了issue。
    详细情况:passwall使用127.0.0.1:5335将远程DNS交给mosdns解析;Dnsmasq转发也转发给5335,此时会出现无法访问海外网站的情况。经过搜索,我在 #470 看到过一样的问题,但是没有解决方案,只是通过将Dnsmasq的转发关闭解决问题,试过,确实可以,但是Dnsmasq就不能转发给mosdns解析了。经过多次测试,很确定是两者启动先后顺序问题导致。passwall必须比mosdns后启动才能正常使用,并且,如果在使用过程中mosdns因修改而重启,那么问题立刻重新出现,passwall必须跟着重启一次才行!

    使用的配置文件

    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-07-09T05:31:31.213Z	INFO	unpacking entry	{"tag": "cn", "length": 11389, "file": "/var/mosdns/geoip_cn.txt"}
    2024-07-09T05:31:31.720Z	INFO	unpacking entry	{"tag": "cn", "length": 80816, "file": "/var/mosdns/geosite_cn.txt"}
    2024-07-09T05:31:31.730Z	INFO	unpacking entry	{"tag": "apple", "length": 1762, "file": "/var/mosdns/geosite_apple.txt"}
    2024-07-09T05:31:31.730Z	INFO	unpacking entry	{"tag": "geolocation-!cn", "length": 25190, "file": "/var/mosdns/geosite_geolocation-!cn.txt"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "geosite_cn", "type": "domain_set"}
    2024-07-09 05:31:32	INFO	starting api http server	{"addr": "0.0.0.0:9091"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "geoip_cn", "type": "ip_set"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "geosite_apple", "type": "domain_set"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "geosite_no_cn", "type": "domain_set"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "whitelist", "type": "domain_set"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "blocklist", "type": "domain_set"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "greylist", "type": "domain_set"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "ddnslist", "type": "domain_set"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "hosts", "type": "hosts"}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "redirect", "type": "redirect"}
    2024-07-09 05:31:32	INFO	redirect	redirect rules loaded	{"length": 0}
    2024-07-09 05:31:32	INFO	loading plugin	{"tag": "adlist", "type": "domain_set"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "local_ptr", "type": "domain_set"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "cloudflare_cidr", "type": "ip_set"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "lazy_cache", "type": "cache"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "forward_xinfeng_udp", "type": "forward"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "forward_local", "type": "forward"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "forward_remote", "type": "forward"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "forward_remote_upstream", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "modify_ttl", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "modify_ddns_ttl", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "has_resp_sequence", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_non_local_ip", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "fallback", "type": "fallback"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "apple_domain_fallback", "type": "fallback"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_apple_domain", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_ddns_domain", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_local_domain", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_no_local_domain", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_whitelist_domain", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_greylist_domain", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "query_is_reject_domain", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "main_sequence", "type": "sequence"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "udp_server", "type": "udp_server"}
    2024-07-09 05:31:33	INFO	udp_server	udp server started	{"addr": "[::]:5335"}
    2024-07-09 05:31:33	INFO	loading plugin	{"tag": "tcp_server", "type": "tcp_server"}
    2024-07-09 05:31:33	INFO	tcp_server	tcp server started	{"addr": "[::]:5335", "tls": false}
    2024-07-09 05:31:33	INFO	all plugins are loaded
    2024-07-09 05:31:42	WARN	udp_server	entry err	{"query": {"uqid": 1, "client": "::ffff:127.0.0.1", "qname": "www.google.com.", "qtype": 1, "qclass": 1, "elapsed": "5.000256545s"}, "error": "context deadline exceeded"}
    2024-07-09 05:31:42	WARN	forward_remote	upstream error	{"uqid": 2, "qname": "www.google.com.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}