Linux nslookup命令对DNS域名服务器进行故障排除
nslookup是一种网络管理命令行工具,可用于许多计算机操作系统,用于查询域名系统(DNS)以获取域名或IP地址映射或任何其他特定的DNS记录。本文详细介绍了nslookup命令。Nslookup可以在两种模式下运行,即Interactive和Non-Interactive。该交互模式用于查询DNS,服务器有关的各种域和主机。非交互模式用于查询域或主机的信息。
要查找查找域的“A”记录(IP地址),请使用以下命令–
$ sudo nslookup tutorialspoint.com
样本输出应如下所示–
Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: Name: tutorialspoint.com Address: 117.18.237.191
上面的命令提供有关tutorialspoint.com的信息。非权威性答案显示Nhooo.com的记录
要查找反向域查找,请使用以下命令–
$ sudo nslookup 209.191.122.70
样本输出应如下所示–
Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: 70.122.191.209.in-addr.arpaname = UNKNOWN-209-191-122-X.yahoo.com. Authoritative answers can be found from:
要查找MX查询(邮件交换)记录,请使用以下命令-
$ sudo nslookup -query=mx www.yahoo.com
样本输出应如下所示–
Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: www.yahoo.comcanonical name = fd-fp3.wg1.b.yahoo.com. Authoritative answers can be found from: wg1.b.yahoo.com origin = yf1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 1461733777 refresh = 30 retry = 30 expire = 86400 minimum = 300
MX报告用于将站点名称映射到该区域的邮件交易服务器记录。基本上,它会告诉您收到/发送到@yahoo.com的所有邮件,然后将其路由到邮件服务器。
要查找查询NS(名称服务器)记录,请使用以下命令–
$ sudo nslookup -query=ns www.yahoo.com
样本输出应如下所示–
Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: www.yahoo.comcanonical name = fd-fp3.wg1.b.yahoo.com. Authoritative answers can be found from: wg1.b.yahoo.com origin = yf1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 1461734024 refresh = 30 retry = 30 expire = 86400 minimum = 300
要查找查询SOA(授权开始)记录,请使用以下命令-
$ sudo nslookup -type=soa www.yahoo.com
样本输出应如下所示–
Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: www.yahoo.comcanonical name = fd-fp3.wg1.b.yahoo.com. Authoritative answers can be found from: wg1.b.yahoo.com origin = yf1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 1461734126 refresh = 30 retry = 30 expire = 86400 minimum = 300
要查询所有可用的DNS记录,请使用以下命令-
$ sudo nslookup -query=any yahoo.com
样本输出应如下所示–
Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: yahoo.comhas AAAA address 2001:4998:44:204::a7 yahoo.comnameserver = ns5.yahoo.com. yahoo.comnameserver = ns2.yahoo.com. yahoo.comnameserver = ns6.yahoo.com. yahoo.com origin = ns1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 2016042624 refresh = 3600 retry = 300 expire = 1814400 minimum = 600 yahoo.com has AAAA address 2001:4998:c:a06::2:4008 yahoo.com mail exchanger = 1 mta6.am0.yahoodns.net. yahoo.com mail exchanger = 1 mta5.am0.yahoodns.net. yahoo.com nameserver = ns4.yahoo.com. yahoo.com has AAAA address 2001:4998:58:c02::a9 yahoo.com nameserver = ns3.yahoo.com. yahoo.com nameserver = ns1.yahoo.com. yahoo.com mail exchanger = 1 mta7.am0.yahoodns.net. Authoritative answers can be found from:
要启用调试模式,请使用以下命令–
$ sudo nslookup -debug yahoo.com
样本输出应如下所示–
Server: 127.0.1.1 Address: 127.0.1.1#53 ------------ QUESTIONS: yahoo.com, type = A, class = IN ANSWERS: -> yahoo.com internet address = 206.190.36.45 ttl = 810 -> yahoo.com internet address = 98.139.183.24 ttl = 810 -> yahoo.com internet address = 98.138.253.109 ttl = 810 AUTHORITY RECORDS: ADDITIONAL RECORDS: ------------ Non-authoritative answer: Name:yahoo.com Address: 206.190.36.45 Name:yahoo.com Address: 98.139.183.24 Name:yahoo.com Address: 98.138.253.109
恭喜你!现在,您知道“LinuxNslookup命令对DNS(域名服务器)进行故障排除”。在我们的下一篇Linux文章中,我们将详细了解这些类型的命令。继续阅读!