$ORIGIN example.com. ; not necessary, using this to self-document
$TTL 3600
@ IN SOA ns1.example.com. admin.example.com. (
1970010100 7200 1800 1209600 300)
@ IN NS ns1.example.com.
@ IN NS ns2.example.com.
@ IN A 198.51.100.1
ns1 IN A 198.51.100.2
ns2 IN A 198.51.100.3
sub1 IN NS ns1.example.edu.
sub2 IN NS ns1.sub2
ns1.sub2 IN A 203.0.113.1 ; inline glue record
Run Code Online (Sandbox Code Playgroud)
NS 记录在域顶点下的作用是众所周知的。它们的存在是为了将子域的权限委托给另一个名称服务器。上面的例子应包括的NS记录sub1和sub2。这些允许名称服务器为它认为自己不具有权威性的域部分分发引用。
在NS的目的,记录在一个域的顶点,ns1而ns2在这种情况下,似乎较少地受到互联网的大了解。我的理解(可能不是整体的)如下:
NS 记录的目的是告诉客户端哪个名称服务器肯定知道域名的实际 IP 地址。因此,例如,以下查询告诉您,如果您想获得有关facebook.com您必须询问的权威答案a.ns.facebook.com:
> dig ns facebook.com 19:58:27
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> ns facebook.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32063
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;facebook.com. IN NS
;; ANSWER SECTION:
facebook.com. 65000 IN NS a.ns.facebook.com.
facebook.com. 65000 IN NS b.ns.facebook.com.
;; Query time: 13 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Sun Mar 20 …Run Code Online (Sandbox Code Playgroud)