; <<>> DiG 9.19.4-1+0~20220818.83+debian11~1.gbp3f0f1b-Debian <<>> www.r2wind.cn +trace ;; global options: +cmd . 0 IN NS f.root-servers.net. . 0 IN NS e.root-servers.net. . 0 IN NS j.root-servers.net. . 0 IN NS i.root-servers.net. . 0 IN NS g.root-servers.net. . 0 IN NS b.root-servers.net. . 0 IN NS d.root-servers.net. . 0 IN NS h.root-servers.net. . 0 IN NS c.root-servers.net. . 0 IN NS k.root-servers.net. . 0 IN NS l.root-servers.net. . 0 IN NS m.root-servers.net. . 0 IN NS a.root-servers.net. ;; Received 432 bytes from 192.168.192.1#53(192.168.192.1) in 859 ms # 递归返回根域名服务器的 NS 记录
cn. 172800 IN NS a.dns.cn. cn. 172800 IN NS d.dns.cn. cn. 172800 IN NS e.dns.cn. cn. 172800 IN NS c.dns.cn. cn. 172800 IN NS b.dns.cn. cn. 172800 IN NS ns.cernet.net. cn. 172800 IN NS g.dns.cn. cn. 172800 IN NS f.dns.cn. cn. 86400 IN DS 57724 8 2 5D0423633EB24A499BE78AA22D1C0C9BA36218FF49FD95A4CDF1A4AD 97C67044 cn. 86400 IN RRSIG DS 8 1 86400 20220920040000 20220907030000 20826 . Pir1xOUL//xWJtc9ey7zZJDmwSPnXHGGLTHpxxuOKwxchQkQvoSYGtCG L6YrRWEpFputpuFpK3DvPCbtPZQMje1Mr2H4vT7nZ47ht0Xr2brWSDlR maELk8iKsuNYwoJ3fL75yn1N0jEABxnYFfo9r4Pp0nfN0XVAIHvAiGE8 nhEFSmmmEZidrLfPT84+QKeXOc8fotDme/Byi5F3Uc3IRu8mq7BE/N/+ 4nXAVgXbWhO9/ULnlAK76bFqoz0qZmvrcrmSB08K//QVG4io+4nbpFyl dUlziRCAiT6h7L6WwK9XDBeWNhSMptvYJRVS01rC2X7OWqKvnU2fL/Bs FYzCSg== ;; Received 708 bytes from 202.12.27.33#53(m.root-servers.net) in 99 ms # 根域名服务器返回 cn 域名的 NS 记录
;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.cn failed: network unreachable. ;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.cn failed: network unreachable. ;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.cn failed: network unreachable. r2wind.cn. 86400 IN NS ns3.dnsv4.com. r2wind.cn. 86400 IN NS ns4.dnsv4.com. 3QDAQA092EE5BELP64A74EBNB8J53D7E.cn. 21600 IN NSEC3 1 1 10 AEF123AB 3QHKTF6LTFG8AAFUUAJSR8RVAJP99SFU NS SOA RRSIG DNSKEY NSEC3PARAM 3QDAQA092EE5BELP64A74EBNB8J53D7E.cn. 21600 IN RRSIG NSEC3 8 2 21600 20220929034902 20220830024902 38388 cn. nQpTOptIW40mn9r1uPSO/yIvyEcdfV/zhfXVU/nZptRs+gDk8MYnqO7c i3yXB2XYzZFXM3ofDWXIJHgHq42agy02zSkDKN3XabB0Y6F2Oy3FhFBP O5fNM97I5Nu1NEE2ZZ5XyGAfMZyNhjsOry66+56C4s/Dlu1LcE151vey ecY= 8TF4MEBDESE2OSVH717D9VC1F7BFN1VI.cn. 21600 IN NSEC3 1 1 10 AEF123AB 8TKMCNJ923RR3GI4UAK4FF8RHB788CNF CNAME RRSIG 8TF4MEBDESE2OSVH717D9VC1F7BFN1VI.cn. 21600 IN RRSIG NSEC3 8 2 21600 20220929034902 20220830024902 38388 cn. MgMG/eoy7e3ugs4TjsTxf5Ji9mvFsYYJpM+e4LayayDIMzs3JpkdKgEn ba3BmaaKclE6aDe8iL0uYSNiUMRgfMJb10yg066tDn+6bQH7BHl0paNY REZMB/+idFumyB3icj+JjCxrQe7j2fPp6aQUv3VBaEVLrp22XbnWZsbx scI= ;; Received 608 bytes from 202.112.0.44#53(ns.cernet.net) in 29 ms # cn 域名服务器返回 r2wind.cn. 的 NS 记录
www.r2wind.cn. 600 IN A 120.78.190.225 r2wind.cn. 86400 IN NS ns4.dnsv4.com. r2wind.cn. 86400 IN NS ns3.dnsv4.com. ;; Received 112 bytes from 1.12.0.25#53(ns3.dnsv4.com) in 39 ms # r2wind.cn 域名服务器返回 www.r2wind.cn. 的 A 记录
由上面一大串的流程中可以看到查询是从根开始进行查询的,然后根据返回的各个域名 NS 记录进行查询,直到查询到最终的 A 记录。
可能你会好奇,为什么要有根?
根的主要作用是管理互联网的主目录。可以设想一下,如果没有根,以查询 tencent.com 为例,在查询解析的时候你得先找到 com 的 NS 记录及其对应的 IP 地址,然后才能获取到 tencent.com 的 NS记录 继续进行递归查询。