大网数据广告活动
网站运营与故障问答

How the name server is resolved if its from the same domain?

· 52CE 我爱测

My understanding is, if I browse to example.com, first my computer will ask the root nameservers about the .com TLD nameservers, and it will be given the IP address of the .com TLD nameservers. Once it has the .com TLD nameserver…

问题原文

原帖链接 · Mani Bharathy · CC BY-SA 4.0

My understanding is, if I browse to example.com, first my computer will ask the root nameservers about the .com TLD nameservers, and it will be given the IP address of the .com TLD nameservers. Once it has the .com TLD nameservers, then it asks one of those TLD servers about example.com, and it is given the (authoritative) nameservers of the example.com domain. Then my computer will query that example.com domain's authoritative nameservers for any record it wants (A, MX, etc.), and it will get the IP address. Now it can finally start to communicate to the server it wanted to talk to.

This is all fine. But my problem is, I see many nameservers belong to the domain itself. For example, google.com's name servers are ns1.google.com, ns2.google.com, etc. But it's recursive: in order to find ns1.google.com, one needs to know the google.com nameserver IP address.

I know I'm clearly missing something or misunderstood something, but I don't know what it is.

已采纳解答

原帖链接 · Maximillian Laumeister · CC BY-SA 4.0

Your understanding is correct on the whole (as a minor point of clarification, it's not your computer that will recursively resolve DNS records, it's typically your ISP.)

The "missing piece" you're looking for is the glue record, which is a DNS record specifically designed to fix that circular reference.

Glue records are DNS records created at the domain’s registrar. The record provides a complete answer when the TLD nameserver returns a reference for an authoritative nameserver for a domain. For example, the domain name “example.net” has nameservers “ns1.example.net” “ns2.example.net”. To resolve the domain name, the DNS would query in order: root, TLD nameserver, and authoritative nameserver. However, by having the authoritative nameservers inside the domain itself, these nameservers cannot be found without outside assistance. This is called a ‘circular reference’. Creating a glue record, an A record served by the TLD nameserver, avoids circular references and allows for both DNS name resolution and listing the nameservers inside the domain itself.

So to look up the A record of example.com in your case, your DNS resolver will first go to the .com nameserver, it will ask for the nameservers for example.com, and it will receive not just ns1.example.com and ns2.example.com but ALSO the IP addresses of those nameservers so that your resolver knows which IP addresses to use to make further DNS queries on that domain.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-07-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。