; <<>> DiG 9.19.4-1+0~20220818.83+debian11~1.gbp3f0f1b-Debian <<>> www.r2wind.com +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.com failed: network unreachable. ;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.com failed: network unreachable. ;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.com failed: network unreachable. r2wind.com. 86400 IN NS ns3.dnsv4.com. r2wind.com. 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.com. 的 NS 記錄
www.r2wind.com. 600 IN A 120.78.190.225 r2wind.com. 86400 IN NS ns4.dnsv4.com. r2wind.com. 86400 IN NS ns3.dnsv4.com. ;; Received 112 bytes from 1.12.0.25#53(ns3.dnsv4.com) in 39 ms # r2wind.com 域名伺服器返回 www.r2wind.com. 的 A 記錄
由上面一大串的流程中可以看到查詢是從根開始進行查詢的,然後根據返回的各個域名 NS 記錄進行查詢,直到查詢到最終的 A 記錄。
可能你會好奇,為甚麼要有根?
根的主要作用是管理互聯網的主目錄。可以設想一下,如果沒有根,以查詢 tencent.com 為例,在查詢解析的時候你得先找到 com 的 NS 記錄及其對應的 IP 地址,然後才能獲取到 tencent.com 的 NS記錄 繼續進行遞歸查詢。