withoutxx
V2EX  ›  DNS

dns 的 ptr 请求在什么场景下会用到,直接屏蔽会不会有影响

  •  
  •   withoutxx · Sep 4, 2024 · 2545 views
    This topic created in 627 days ago, the information mentioned may be changed or developed.

    为了实现 ipv4 优先,上了 mosdns ,查看日志中出现了很多 ptr 错误日志, 经过查询,这可能是 apple homekit 产生的,应该是只在内网生效,不应该转发到上游。

    现在两个疑问请教一下各位彦祖

    1.如果屏蔽所有的 ptr 请求,是否会对某些功能产生影响?

    2.现在是在旁路由中启动的 mosdns ,如果把所有的 ptr 请求转发到主路由的原生 openwrt 中,还会不会往上游发送

    // 错误日志
    WARN	forward_local	upstream error	{"uqid": 31381, "qname": "_srpl-tls._tcp.openthread.thread.home.arpa.", "qclass": 1, "qtype": 12, "upstream": "https://120.53.53.53/dns-query", "error": "context deadline exceeded"}
    
    // mosdns 配置
    
    log:
      level: info
      file: "/var/log/mosdns.log"
    
    plugins:
      # 转发至 DNS 服务器
      - tag: forward_local
        type: forward
        args:
          concurrent: 2
          upstreams:
            - addr: "https://223.6.6.6/dns-query"
            - addr: "https://120.53.53.53/dns-query"
        
      # PTR 黑名单 加入的域名将阻止 PTR 请求
      - tag: local_ptr
        type: domain_set
        args:
          files:
            - "/etc/mosdns/rule/local-ptr.txt"
    
      - tag: main
        type: sequence
        args:
          - matches: qname $local_ptr
            exec: reject 3
          - exec: prefer_ipv4
          - exec: cache 5000
          - exec: $forward_local
    
      # 启动 udp 服务器。
      - tag: udp_server
        type: udp_server
        args:
          entry: main
          listen: ":8338"
    
    2 replies    2025-11-09 17:06:15 +08:00
    johnjiang85
        1
    johnjiang85  
       Sep 4, 2024
    可以返回任意的记录结果、nxdomain 、servfail 等,但是最好别直接丢弃,部分网络库和客户端工具要等待 ptr 请求返回才会进行下一步处理,比如部分版本的 ping 、tcpdump 等,如果直接丢包 ptr 请求,会导致工具卡顿,部分工具可以通过指定-n 或者其他类似参数跳过该步骤,但是不能保证所有网络库都能方便的跳过 ptr 请求。
    bclerdx
        2
    bclerdx  
       Nov 9, 2025
    @johnjiang85 本来就不应该跳过 PTR 记录吧,正常情况下,DNS 都应该配置 PTR ,也就是反向记录查询的。但有些 DNS 服务商不配置 PTR 反向记录查询的目的何在?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3642 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 04:47 · PVG 12:47 · LAX 21:47 · JFK 00:47
    ♥ Do have faith in what you're doing.