DiG 传输因 axfr 选项失败

5 dns shell command-line dig

出于测试目的,我尝试使用此方法获取域的所有 DNS 记录集的列表。

这有效:

root@cs:/# dig @nameserver domain

; <<>> DiG 9.9.2-P1 <<>> @nameserver domain
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32999
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;domain.           IN      A

;; ANSWER SECTION:
domain.    3600    IN      A       my-IP

;; Query time: 2 msec
;; SERVER: my-IPv6-IP-(I-think)
;; WHEN: Thu Jun 20 16:03:05 2013
;; MSG SIZE  rcvd: 83
Run Code Online (Sandbox Code Playgroud)

但是,当我axfr按照服务器故障(以及整个网络)的答案中的建议添加命令时,它失败了:

root@cs:/# dig @ns1.transip.nl changeyourschool.nl axfr

; <<>> DiG 9.9.2-P1 <<>> @ns1.transip.nl changeyourschool.nl axfr
; (2 servers found)
;; global options: +cmd
; Transfer failed.
Run Code Online (Sandbox Code Playgroud)

这是为什么,更重要的是,如果失败,我如何获得 DNS 记录的完整列表?

小智 2

我不知道这是为什么,但你可以用它来获取所有 DNS 记录:

root@cs:/# dig google.com ANY +nostat +nocmd +nocomments

; <<>> DiG 9.9.2-P1 <<>> google.com ANY +nostat +nocmd +nocomments
;; global options: +cmd
;google.com.                    IN      ANY
google.com.             56328   IN      NS      ns4.google.com.
google.com.             56328   IN      NS      ns2.google.com.
google.com.             56328   IN      NS      ns1.google.com.
google.com.             56328   IN      NS      ns3.google.com.
ns4.google.com.         85545   IN      A       216.239.38.10
ns1.google.com.         85545   IN      A       216.239.32.10
ns3.google.com.         57402   IN      A       216.239.36.10
ns2.google.com.         85545   IN      A       216.239.34.10
Run Code Online (Sandbox Code Playgroud)

+nostat和添加+nocmd+nocomments可以省略,但减少无用的输出。

  • `any` 和 `axfr` 不一样。“any”仅请求当前主机的记录。`axfr` 请求该主机的整个区域信息。 (7认同)
  • 区域传输(axfr 请求)的目的是跨一组 DNS 服务器复制 DNS 数据库。因此,区域传输通常只允许辅助(从属)名称服务器的 IP 地址。这样的措施可以减轻DNS主服务器的负载。 (2认同)