我对 wikipedia.com 上的这个区域文件有疑问”
$ORIGIN example.com. ; designates the start of this zone file in the namespace
$TTL 1h ; default expiration time of all resource records without their own TTL value
example.com. IN SOA ns.example.com. username.example.com. (
2007120710 ; serial number of this zone file
1d ; slave refresh (1 day)
2h ; slave retry time in case of a problem (2 hours)
4w ; slave expiration time (4 weeks)
1h ; maximum caching time in case of failed lookups (1 hour)
)
example.com. NS ns ; ns.example.com is a nameserver for example.com
example.com. NS ns.somewhere.example. ; ns.somewhere.example is a backup nameserver for example.com
example.com. MX 10 mail.example.com. ; mail.example.com is the mailserver for example.com
@ MX 20 mail2.example.com. ; equivalent to above line, "@" represents zone origin
@ MX 50 mail3 ; equivalent to above line, but using a relative host name
example.com. A 192.0.2.1 ; IPv4 address for example.com
AAAA 2001:db8:10::1 ; IPv6 address for example.com
ns A 192.0.2.2 ; IPv4 address for ns.example.com
AAAA 2001:db8:10::2 ; IPv6 address for ns.example.com
www CNAME example.com. ; www.example.com is an alias for example.com
wwwtest CNAME www ; wwwtest.example.com is another alias for www.example.com
mail A 192.0.2.3 ; IPv4 address for mail.example.com,
; any MX record host must be an address record
; as explained in RFC 2181 (section 10.3)
mail2 A 192.0.2.4 ; IPv4 address for mail2.example.com
mail3 A 192.0.2.5 ; IPv4 address for mail3.example.com
"
Why is these lines necessary?:
example.com. NS ns ; ns.example.com is a nameserver for example.com
ns A 192.0.2.2 ; IPv4 address for ns.example.com
我们已经知道 ns.example.com 是默认名称服务器,对吧?那么我们为什么要指定它的 IP 地址?这个区域文件不是在 ns.example.com 名称服务器中吗?我的意思是,如果我们正在查看它,为什么我们需要包含我们正在查看的文件的服务器的 IP 地址?
答案1
权威名称服务器提供的信息必须与其他地方提供的信息一致。
在这种情况下,解析器已使用粘合记录来查找此名称服务器。此处找到的授权和名称信息必须与 TLD 的授权(NS
示例中的记录)相匹配,而此处找到的主机信息必须与 TLD 提供的额外信息(粘合记录(A
示例中的记录))相匹配。