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

15 天前
 withoutxx

为了实现 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"
797 次点击
所在节点    DNS
1 条回复
johnjiang85
15 天前
可以返回任意的记录结果、nxdomain 、servfail 等,但是最好别直接丢弃,部分网络库和客户端工具要等待 ptr 请求返回才会进行下一步处理,比如部分版本的 ping 、tcpdump 等,如果直接丢包 ptr 请求,会导致工具卡顿,部分工具可以通过指定-n 或者其他类似参数跳过该步骤,但是不能保证所有网络库都能方便的跳过 ptr 请求。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1070177

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX