ウェブサイト検索

DNS ルックアップをトラブルシューティングするための 8 つの Linux Nslookup コマンド


nslookup は、DNS サーバー (ドメイン ネーム サーバー) のテストとトラブルシューティングを行うためのコマンドライン管理ツールです。特定のDNSリソース レコード (RR) をクエリするためにも使用されます。ほとんどのオペレーティング システムには、nslookup 機能が組み込まれています。

この記事では、広く使用されている nslookup コマンドについて詳しく説明します。 Nslookup は、対話型非対話型の 2 つのモードで実行できます。

対話型 モードは、さまざまなドメインやホストについてDNS サーバーにクエリを実行するために使用されます。 非対話型 モードは、ドメインまたはホストの情報をクエリするために使用されます。

次の記事にも興味があるかもしれません :

  • Linux Find コマンドの 35 の実践例
  • Linux ネットワーク管理のための 20 の Netstat コマンド
  • パッケージ管理のための 20 の Linux YUM (Yellowdog Updater、修正版) コマンド
  • Linux での RPM パッケージ管理のための 27 の「DNF」(Yum のフォーク)コマンド

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

上のコマンド クエリ ドメイン www.yahoo.com4.2.2.2 パブリック DNS サーバー、および以下のセクションには 権限のない回答 が表示されます: と表示されます。 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(ネームサーバー)レコードをクエリします。

# 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 (Start of Authority) レコードをクエリします。

# 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. デバッグモードを有効にする

デバッグ モードを有効にするには、「set debug」を実行すると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

この記事では、(DNS) ドメイン ネーム サービス関連情報の検索に役立つ nslookup コマンドについて説明しました。

次の記事では、nslookup に似た Linux dig コマンドについて説明します。この記事が気に入ったら、お友達と共有し、コメント ボックスを通じて貴重なフィードバックをお寄せください。