LoginSignup
1
1

More than 3 years have passed since last update.

DNS書き換え時のnslookup利用シーン

Posted at

はじめに

DNSを書き換えた場合に、正しく設定できたか確認する方法として、ブラウザでアクセスして確認されている方もいるかと思います。

ただブラウザだと一生懸命リロードしても実はキャッシュだったり、ブラウザ変えたりシークレットモードで閲覧すると挙動が異なったりし、混乱してしまい、設定を変更し続けること状況に陥ることがあります。

※ブラウザで確認した際に疑われる点

  1. ブラウザのキャッシュ
  2. PCのキャッシュ
  3. セキュリティソフト
  4. プロキシサーバー
  5. ルーター
  6. プロバイダ、その他DNSサービス
  7. NSレコードに記載されているネームサーバー

→ 経由地が多く、キャッシュかもと疑う点が多い

解決方法

上記の問題を解決する手堅く&手っ取り早い確認方法として、ブラウザではなくnslookupを利用し、ネームサーバーに直接問い合わせする方法があります。

※nslookupで確認した際に疑われる点

  1. NSレコードに記載されているネームサーバー

→ 疑う点が少ない!
→ ネームサーバーに直接問い合わせしているので信頼できる(nslookupがどうなのかは別で)

利用シーンごとの使い方

利用シーン1:DNSが正しく設定されたか調べるとき

実行

shell
// ターミナルでnslookupを起動
$ nslookup

// 問い合わせするネームサーバーを切り替える(例:さくらのNS)
> server ns1.dns.ne.jp

// 問い合わせ(例:example.com)
> example.com

結果

shell
Server:     ns1.dns.ne.jp
Address:    61.211.236.1#53

Name:   example.com
Address: xxx.xxx.xxx.xxx

※結果の読み方
ネームサーバー(ns1.dns.ne.jp)に、「example.com」はどこですか?と問い合わせたらIPアドレス「xxx.xxx.xxx.xxx」のサーバーに設定されています。と返ってきた

「server ns1.dns.ne.jp」を設定していない場合は、デフォルトのネームサーバーに問い合わせになります。

Server:     192.168.11.1
Address:    192.168.11.1#53
// ルーターのIPが返ってきます。

利用シーン2: NS(ネームサーバー)はどこか調べる

実行

shell
// ターミナルでnslookupを起動
$ nslookup

// クエリータイプをNSレコードに変更
> set q=ns

// 問い合わせ(例:example.com)
> example.com

結果

shell
Server:     192.168.11.1
Address:    192.168.11.1#53

Non-authoritative answer:
masking-tape.jp nameserver = ns-999.awsdns-99.com.
masking-tape.jp nameserver = ns-999.awsdns-99.co.uk.
masking-tape.jp nameserver = ns-999.awsdns-99.org.
masking-tape.jp nameserver = ns-999.awsdns-99.net.

Authoritative answers can be found from:
ns-999.awsdns-99.com    internet address = xxx.xxx.xxx.xxx
ns-999.awsdns-99.net    internet address = xxx.xxx.xxx.xxx
ns-999.awsdns-99.org    internet address = xxx.xxx.xxx.xxx

上記のような結果が帰ってくるので、その中からAuthoritative answers can be found from:に記載されている内容を確認する。

バリュードメインの場合

example.com nameserver = ns2.value-domain.com.
example.com nameserver = ns1.value-domain.com.

さくらの場合

example.com nameserver = ns2.dns.ne.jp.
example.com nameserver = ns1.dns.ne.jp.

ムームーの場合

example.com nameserver = dns02.muumuu-domain.com.
example.com nameserver = dns01.muumuu-domain.com.

AWS Route53の場合

example.com nameserver = ns-135.awsdns-16.com.
example.com nameserver = ns-1655.awsdns-14.co.uk.

利用シーン3: TXTレコードにSPFが設定されているか

実行

shell
// ターミナルでnslookupを起動
$ nslookup

// クエリータイプをTXTレコードに変更
> set q=txt

// 問い合わせ(例:example.com)
> example.com

結果

shell
Server:     192.168.11.1
Address:    192.168.11.1#53

Non-authoritative answer:
example.com text = "v=spf1 +a:example.com +ip4:xxx.xxx.xxx.xxx ~all"

Authoritative answers can be found from:
・・・

上記のような結果が帰ってくるので、その中よりexample.com text = "v=spf1・・・・のような記載を確認する

参考サイト

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1