1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DNS系の検証時は必ずキャッシュクリアを実施しよう

Posted at

概要

あるドメインに同じ条件で環境毎のサブドメインを登録し手元の端末からアクセス確認したが、特定環境のURLのみアクセスできない事象が発生した。

そのときの調査内容と解決方法の備忘録。

  • ブラウザからアクセス ⇒ NXDOMAIN
  • nslookup ⇒ NXDOMAIN
  • dig +trace ⇒ IPが返ってくる

結論

同じレコード名で何度も設定を変更していたせいか、DNSキャッシュにネガティブキャッシュが残っていた(おそらく)

dig +traceで意図したとおりにIPが返ってきていたのでレコード周りの設定は問題なかったが、nslookupやブラウザからのアクセスではキャッシュDNSサーバーへ問い合わせてネガティブキャッシュを引いていたため、NXDOMAINが返っていた(dig +traceは非再帰問い合わせなのでキャッシュDNSサーバーには問い合わせない)

以下の手順でキャッシュクリアを実施することで解決。

Windows
コマンドプロンプトで以下を実施

ipconfig /flushdns

Chrome
アドレスバーで chrome://net-internals/#dns を開き[Clear host cache]をクリック
image.png

アドレスバーで chrome://net-internals/#socketsを開き[Flush socket pools]をクリック
image.png

参考:
PCのDNSキャッシュをクリアする方法
ネガティブキャッシュ(negative cache)
DNS resolver / recursive query iterative query

まとめ

  • dig +traceで問題なく名前解決できていればレコード設定周りには問題なしと判断できる
  • nslookupやブラウザからのアクセスが通らない場合はキャッシュDNSを疑う

おまけ

nslookup・digの実行について

コマンド実行環境が無くても以下のサイトでnslookupとdigの両方を試せる
nslookup(dig)テスト【DNSサーバ接続確認】

Windowsで特定ドメインのDNSキャッシュ情報を調べる

PowerShellで以下のコマンドを実行

ipconfig /displaydns | Out-String -Stream | Select-String -Pattern "example.com" -Context 0,5
1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?