V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
withoutxx
V2EX  ›  DNS

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

  •  
  •   withoutxx · 15 天前 · 798 次点击

    为了实现 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"
    
    1 条回复
    johnjiang85
        1
    johnjiang85  
       15 天前
    可以返回任意的记录结果、nxdomain 、servfail 等,但是最好别直接丢弃,部分网络库和客户端工具要等待 ptr 请求返回才会进行下一步处理,比如部分版本的 ping 、tcpdump 等,如果直接丢包 ptr 请求,会导致工具卡顿,部分工具可以通过指定-n 或者其他类似参数跳过该步骤,但是不能保证所有网络库都能方便的跳过 ptr 请求。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1091 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 22:41 · PVG 06:41 · LAX 15:41 · JFK 18:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.