nslookupは、DNSサーバー(ドメインネームサーバー)をテストおよびトラブルシューティングするためのコマンドライン管理ツールです。特定のDNSリソースレコード(RR)を問い合わせるためにも使用されます。ほとんどのオペレーティングシステムには、組み込みのnslookup機能が付属しています。
この記事では、広く使用されているnslookupコマンドを詳しく説明します。Nslookupは、インタラクティブモードと非インタラクティブモードで実行できます。
インタラクティブモードは、さまざまなドメインやホストに関するDNSサーバーへの問い合わせに使用されます。 非インタラクティブモードは、ドメインやホストの情報に関する問い合わせに使用されます。
次の記事もお役に立ちます:
- Linux Findコマンドの実用例35選
- Linuxネットワーク管理のための20のNetstatコマンド
- パッケージ管理のための20のLinux YUM(Yellowdog Updater、Modified)コマンド
- 27 ‘DNF’(Yumのフォーク)コマンド:LinuxでのRPMパッケージ管理
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.comというドメインを4.2.2.2というパブリックDNSサーバーに問い合わせ、以下のセクションには非公式の回答が表示され、Aレコードの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(権威の開始)レコードをクエリする
# 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コマンドをカバーしようとしました。
次の記事は、digコマンドに関するものであり、これはnslookupに類似しています。この記事が気に入ったら、友達と共有していただき、コメントボックスから貴重なフィードバックをお願いします。
Source:
https://www.tecmint.com/8-linux-nslookup-commands-to-troubleshoot-dns-domain-name-server/