8个Linux Nslookup命令排除DNS(域名服务器)

nslookup是用于测试和解决DNS服务器(域名服务器)的命令行管理工具。它用于查询特定的DNS资源

NSLOOKUP是用于测试和故障排除的DNS服务器( 域名服务器 )的命令行管理工具。 它被用于查询特定DNS资源记录(RR)为好。大多数操作系统都带有内置的nslookup功能。
Linux Nslookup Commands

Linux Nslookup命令

本文详细演示了广泛使用nslookup命令。 交互式非交互 :Nslookup的可以在两种模式下运行。 交互模式用于查询有关各种域和主机的DNS的服务器非交互模式用于查询域名或主机的信息。 您可能也感兴趣以下文章:
  1. 35个Linux查找命令的实际示例
  2. 20个用于Linux网络管理的Netstat命令
  3. 20个Linux YUM(Yellowdog Updater,Modified)软件包管理命令

1.找出域的“A”记录(IP地址)

# nslookup yahoo.com
Server:         4.2.2.2
Address:        4.2.2.2#53
Non-authoritative answer:
Name:   yahoo.com
Address: 72.30.38.140
Name:   yahoo.com
Address: 98.139.183.24
Name:   yahoo.com
Address: 209.191.122.70
以上4.2.2.2公共DNS服务器和下面的命令查询域www.yahoo.com部分显示非权威的答案 :显示www.yahoo.com 记录

2.找出反向域查找

# nslookup 209.191.122.70
Server:         4.2.2.2
Address:        4.2.2.2#53
Non-authoritative answer:
70.122.191.209.in-addr.arpa     name = ir1.fp.vip.mud.yahoo.com.
Authoritative answers can be found from:

3.找出特定的域查找。

# nslookup ir1.fp.vip.mud.yahoo.com.
Server:         4.2.2.2
Address:        4.2.2.2#53
Non-authoritative answer:
Name:   ir1.fp.vip.mud.yahoo.com
Address: 209.191.122.70

4.查询MX(邮件交换)记录。

# nslookup -query=mx www.yahoo.com
Server:         4.2.2.2
Address:        4.2.2.2#53
Non-authoritative answer:
www.yahoo.com   canonical name = fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com  canonical name = ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com  canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com.
ds-any-fp3-lfb.wa1.b.yahoo.com  canonical name = ds-any-fp3-real.wa1.b.yahoo.com.
Authoritative answers can be found from:
wa1.b.yahoo.com
origin = yf1.yahoo.com
mail addr = hostmaster.yahoo-inc.com
serial = 1344827307
refresh = 30
retry = 30
expire = 86400
minimum = 1800
MX记录被用于域名映射到该域的邮件交换服务器列表。 因此,它告诉接收/发送到@ yahoo.com将被路由到邮件服务器的所有邮件。

5.查询NS(Nameservers)记录。

# nslookup -query=ns www.yahoo.com
Server:         4.2.2.2
Address:        4.2.2.2#53
Non-authoritative answer:
www.yahoo.com   canonical name = fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com  canonical name = ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com  canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com.
ds-any-fp3-lfb.wa1.b.yahoo.com  canonical name = ds-any-fp3-real.wa1.b.yahoo.com.
Authoritative answers can be found from:
wa1.b.yahoo.com
origin = yf1.yahoo.com
mail addr = hostmaster.yahoo-inc.com
serial = 1344827782
refresh = 30
retry = 30
expire = 86400
minimum = 1800

6.查询SOA(开始授权)记录。

# nslookup -type=soa www.yahoo.com
Server:         4.2.2.2
Address:        4.2.2.2#53
Non-authoritative answer:
www.yahoo.com   canonical name = fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com  canonical name = ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com  canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com.
ds-any-fp3-lfb.wa1.b.yahoo.com  canonical name = ds-any-fp3-real.wa1.b.yahoo.com.
Authoritative answers can be found from:
wa1.b.yahoo.com
origin = yf1.yahoo.com
mail addr = hostmaster.yahoo-inc.com
serial = 1344827965
refresh = 30
retry = 30
expire = 86400
minimum = 1800

7.查询所有可用的DNS记录。

# nslookup -query=any yahoo.com
Server:         4.2.2.2
Address:        4.2.2.2#53
Non-authoritative answer:
yahoo.com
origin = ns1.yahoo.com
mail addr = hostmaster.yahoo-inc.com
serial = 2012081016
refresh = 3600
retry = 300
expire = 1814400
minimum = 600
Name:   yahoo.com
Address: 98.139.183.24
Name:   yahoo.com
Address: 209.191.122.70
Name:   yahoo.com
Address: 72.30.38.140
yahoo.com       mail exchanger = 1 mta7.am0.yahoodns.net.
yahoo.com       mail exchanger = 1 mta5.am0.yahoodns.net.
yahoo.com       mail exchanger = 1 mta6.am0.yahoodns.net.
yahoo.com       nameserver = ns3.yahoo.com.
yahoo.com       nameserver = ns4.yahoo.com.
yahoo.com       nameserver = ns2.yahoo.com.
yahoo.com       nameserver = ns8.yahoo.com.
yahoo.com       nameserver = ns1.yahoo.com.
yahoo.com       nameserver = ns6.yahoo.com.
yahoo.com       nameserver = ns5.yahoo.com.
Authoritative answers can be found from:

8.启用调试模式

要启用调试模式 “组调试”将返回详细信息,如TTL,这里的输出。
# nslookup -debug yahoo.com
> set debug
> yahoo.com
Server:         4.2.2.2
Address:        4.2.2.2#53
------------
QUESTIONS:
yahoo.com, type = A, class = IN
ANSWERS:
->  yahoo.com
internet address = 72.30.38.140
ttl = 1523
->  yahoo.com
internet address = 98.139.183.24
ttl = 1523
->  yahoo.com
internet address = 209.191.122.70
ttl = 1523
AUTHORITY RECORDS:
ADDITIONAL RECORDS:
------------
Non-authoritative answer:
Name:   yahoo.com
Address: 72.30.38.140
Name:   yahoo.com
Address: 98.139.183.24
Name:   yahoo.com
Address: 209.191.122.70
在本文中,我们试图掩盖Nslookup的命令,它可以帮助你找到(DNS)域名服务相关的信息。 下一篇文章将在Linux上挖命令是与nslookup类似。如果你喜欢的文章,请与您的朋友分享,不要忘记通过评论框提供您宝贵的反馈。