ホームページ  >  記事  >  運用・保守  >  Linux nslookup コマンドのヘルプと DNS ルックアップの例

Linux nslookup コマンドのヘルプと DNS ルックアップの例

不言
不言オリジナル
2019-03-13 10:24:145672ブラウズ

nslookup は「ネーム サーバー ルックアップ」の略で、DNS サーバーから情報を取得するのに便利なコマンドです。また、DNS 関連の問題のトラブルシューティングにも非常に役立ち、DNS (ドメイン ネーム サーバー) にクエリを実行して、IP アドレスの任意のドメインの DNS レコードを取得できます。

Linux nslookup コマンドのヘルプと DNS ルックアップの例

#DNS ルックアップの例

次のコマンドを使用して、ドメインのアドレス レコードを検索します。ネームサーバーにクエリを実行し、詳細を取得します。

# nslookup google.com
Server:         8.8.8.8
Address:        8.8.8.8#53
Non-authoritative answer:
Name:   google.com
Address: 216.58.219.206

DNS 逆引き参照

IP アドレスを DNS 逆引き参照に使用することもでき、その IP アドレスを使用して対応するドメインを解決することもできます。これは、ドメインの逆ゾーンで構成された別のレコードであることに注意してください。

# nslookup 216.58.219.206
Server:         8.8.8.8
Address:        8.8.8.8#53
Non-authoritative answer:
206.219.58.216.in-addr.arpa     name = lga25s40-in-f14.1e100.net.
206.219.58.216.in-addr.arpa     name = lga25s40-in-f14.1e100.net.
206.219.58.216.in-addr.arpa     name = lga25s40-in-f206.1e100.net.
206.219.58.216.in-addr.arpa     name = lga25s40-in-f206.1e100.net.

特定の DNS サーバーにクエリを実行する

特定の DNS サーバーにクエリを実行することもできます。ネームサーバーの IP アドレスまたはドメイン名に対して追加のパラメーターを渡す必要があります。たとえば、8.8.4.4 ネーム サーバーにクエリを実行するには、次のコマンドを使用します。

# nslookup google.com 8.8.4.4
Server:         8.8.4.4
Address:        8.8.4.4#53
Non-authoritative answer:
Name:   google.com
Address: 216.58.219.206

ドメインの SOA レコードの検索

nslookup を使用して、任意のドメインの SOA (承認の開始) レコードを検索します。たとえば、ドメイン google.com の SOA レコードを検索するには、次のコマンドを使用できます。 type-type=soa をコマンドラインパラメータとして指定する必要があります。

# nslookup -type=soa google.com
Server:         8.8.8.8
Address:        8.8.8.8#53
Non-authoritative answer:
google.com
        origin = ns4.google.com
        mail addr = dns-admin.google.com
        serial = 159912615
        refresh = 900
        retry = 900
        expire = 1800
        minimum = 60
Authoritative answers can be found from:

origin: 情報源の権威。


mail addr: ドメイン管理者の電子メール アドレス (最初のドットは電子メール アドレスの @ 記号を表します)。

serial: YYYYMMDDNN 形式のドメイン領域のリビジョン データ。

refresh: セカンダリ ネーム サーバーがプライマリ ネーム サーバーにゾーンの更新バージョンをチェックする参照間隔 (秒単位)。

retry: 失敗した試行後にプライマリ ネーム サーバーへの再接続を試行する前に、セカンダリ ネーム サーバーを待機する時間。

expire: セカンダリ ネーム サーバー キャッシュが期限切れになるまでの時間 (秒単位)。

minimum: 最後のフラッシュから時間が経過していない場合に、セカンダリ ネーム サーバーのキャッシュをフラッシュしてはならない時間 (秒単位)。

ドメインの MX レコードの検索

電子メールの配信を担当する任意のドメインの MX (メール交換) レコードをクエリすることもできます。

# nslookup -query=mx google.com
Server:         8.8.8.8
Address:        8.8.8.8#53
Non-authoritative answer:
google.com      mail exchanger = 10 aspmx.l.google.com.
google.com      mail exchanger = 30 alt2.aspmx.l.google.com.
google.com      mail exchanger = 50 alt4.aspmx.l.google.com.
google.com      mail exchanger = 40 alt3.aspmx.l.google.com.
google.com      mail exchanger = 20 alt1.aspmx.l.google.com.
Authoritative answers can be found from:

ドメインの TXT レコードの検索

TXT レコードは、さまざまな種類のレコード (DKIM、SPF など) に役立ちます。以下のコマンドを使用すると、任意のドメインに構成されているすべての TXT レコードを検索できます。

# nslookup -query=txt google.com
Server:         8.8.8.8
Address:        8.8.8.8#53
Non-authoritative answer:
google.com      text = "v=spf1 include:_spf.google.com ~all"
Authoritative answers can be found from:

ドメインのすべてのレコードの検索

任意のドメインのすべてのレコードを一覧表示するには、-query=any を使用します。

# nslookup -query=any google.com
Server:         8.8.8.8
Address:        8.8.8.8#53
Non-authoritative answer:
Name:   google.com
Address: 216.58.219.206
google.com      has AAAA address 2607:f8b0:4006:80e::200e
google.com      mail exchanger = 20 alt1.aspmx.l.google.com.
google.com      mail exchanger = 40 alt3.aspmx.l.google.com.
google.com      nameserver = ns2.google.com.
google.com      nameserver = ns4.google.com.
google.com      nameserver = ns3.google.com.
google.com      rdata_257 = 0 issue "pki.goog"
google.com      mail exchanger = 30 alt2.aspmx.l.google.com.
google.com      mail exchanger = 10 aspmx.l.google.com.
google.com      mail exchanger = 50 alt4.aspmx.l.google.com.
google.com      text = "v=spf1 include:_spf.google.com ~all"
google.com      nameserver = ns1.google.com.
google.com      rdata_257 = 0 issue "symantec.com"
google.com
        origin = ns2.google.com
        mail addr = dns-admin.google.com
        serial = 159912615
        refresh = 900
        retry = 900
        expire = 1800
        minimum = 60
Authoritative answers can be found from:

対話モードでの Nslookup

対話モードで nslookup を使用することもできます。対話モードに入るには、コンソールで nslookup と入力し、Enter キーを押します。 > のような nslookup プロンプトが表示されます。ここで、同じクエリを実行して、DNS サーバーからドメインの情報を取得できます。理解を容易にするために、コマンド間にコメントが追加されています。

root@tecadmin:~#nslookup
### Type domain name to get information from dns server 
> google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.10.46

### Set the another specific dns server to query. 
> server 8.8.4.4 
Default server: 8.8.4.4
Address: 8.8.4.4#53

### Again try to get the dns information, This time nslookup connects to specified dns server. 
> google.com 
Server:         8.8.4.4
Address:        8.8.4.4#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.10.46

### Set the query type. for example to get MX information set query=mx 
> set query=mx 

### Again try to get the dns information, This time nslookup will show MX information for domain 
> google.com 
Server:         8.8.4.4
Address:        8.8.4.4#53

Non-authoritative answer:
google.com      mail exchanger = 30 alt2.aspmx.l.google.com.
google.com      mail exchanger = 50 alt4.aspmx.l.google.com.
google.com      mail exchanger = 40 alt3.aspmx.l.google.com.
google.com      mail exchanger = 10 aspmx.l.google.com.
google.com      mail exchanger = 20 alt1.aspmx.l.google.com.

Authoritative answers can be found from:

この記事はここで終了しました。さらにエキサイティングなコンテンツについては、php 中国語 Web サイトにある他の関連コラム チュートリアルに注目してください。 ! !

以上がLinux nslookup コマンドのヘルプと DNS ルックアップの例の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。