DNS的名称记录
2008-04-09 16:31:22 来源:WEB开发网验DNS工作
当您建立好一个DNS伺服器之後除了可以直接使用命令 ping (这个会在後面章节说明)直接ping一下上面的记录之外最好还是使用“nslookup”这个命令进行检测或除错(Windows9x系统并不包含此命令)。下面让我们在Linux中验一下当您输入nslookup之後您会看到您机器目前指定的DNS伺服器的回应
Default Server: redhat52.siyongc.domain
Address: 192.168.0.17
然後您输入欲查询的主机或IP地址您会看到从DNS回来的结果
> pii266.siyongc.domain
Server: redhat52.siyongc
Address: 192.168.0.17
Name: pii266.siyongc.domain
Address: 192.168.0.15
> www.hinet.net
Server: redhat52.siyongc.domain
Address: 192.168.0.17
Non-authoritative answer:
Name: w3c2.hinet.net
Address: 168.95.1.84
Aliases: www.hinet.net
这是一个标准模式下面的查询我们可以看到不是这台DNS伺服器管理的查询而且已经在 cache 里面了会附加一个“Non-authoritative answer:”的回应信息。但如果我们先将查询模式设为any之後再输入同样的主机名称
> set q=any
> pii266.siyongc.domain
Server: redhat52.siyongc.domain
Address: 192.168.0.17
pii266.siyongc.domain preference = 20, mail exchanger = debian.home
pii266.siyongc.domain preference = 10, mail exchanger = redhat52.siyongc.domain
pii266.siyongc.domain internet address = 192.168.0.15
siyongc.domain nameserver = debian.home
siyongc.domain nameserver = redhat52.siyongc.domain
debian.home internet address = 192.168.0.2
redhat52.siyongc.domain internet address = 192.168.0.17
您就可以看到更多的资料了例如MXNS和它们的IP地址等信息。假如您使用“除错模式”的话看到的资料还将更多
> set debug
> www.hinet.net
Server: redhat52.siyongc.domain
Address: 192.168.0.17
;; res_nmkquery(QUERY, www.hinet.net, IN, ANY)
------------
Got answer:
HEADER:
opcode = QUERY, id = 3102, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 3, additional = 3
QUESTIONS:
www.hinet.net, type = ANY, class = IN
ANSWERS:
-> www.hinet.net
canonical name = w3c2.hinet.net
ttl = 76134 (21h8m54s)
AUTHORITY RECORDS:
-> hinet.net
nameserver = HNTP1.hinet.net
ttl = 162533 (1d21h8m53s)
-> hinet.net
nameserver = HNTP3.hinet.net
ttl = 162533 (1d21h8m53s)
-> hinet.net
nameserver = DNS.hinet.net
ttl = 162533 (1d21h8m53s)
ADDITIONAL RECORDS:
-> HNTP1.hinet.net
internet address = 168.95.192.1
ttl = 162533 (1d21h8m53s)
-> HNTP3.hinet.net
internet address = 168.95.192.2
ttl = 162533 (1d21h8m53s)
-> DNS.hinet.net
internet address = 168.95.1.1
ttl = 162533 (1d21h8m53s)
------------
Non-authoritative answer:
www.hinet.net
canonical name = w3c2.hinet.net
ttl = 76134 (21h8m54s)
Authoritative answers can be found from:
hinet.net
nameserver = HNTP1.hinet.net
ttl = 162533 (1d21h8m53s)
hinet.net
nameserver = HNTP3.hinet.net
ttl = 162533 (1d21h8m53s)
hinet.net
nameserver = DNS.hinet.net
ttl = 162533 (1d21h8m53s)
HNTP1.hinet.net
internet address = 168.95.192.1
ttl = 162533 (1d21h8m53s)
HNTP3.hinet.net
internet address = 168.95.192.2
ttl = 162533 (1d21h8m53s)
DNS.hinet.net
internet address = 168.95.1.1
ttl = 162533 (1d21h8m53s)
另外您还可以用 set q=mx 或 set q=ptr 等模式来查询特定的记录也可以用 ls 後接 domain name 来查看某个 domain 的所有主机记录。善用 nslookup 我们可以找到许多 DNS 的信息而当有问题发生的时候这个工具就变得非常有用了。
同时在设定 DNS 的时候需要比较慎密的设计以免不实资料的滥。管理好 DNS 系统是每一个网路管理员应尽的义务来的。
更多精彩
赞助商链接