DNSキャッシュ効率/キャッシュエントリを測定する方法は?

DNSキャッシュ効率/キャッシュエントリを測定する方法は?

dnsmasq私はDebianサーバーにキャッシュ専用のDNSサーバーを設定しましたが、うまく動作しています(digを介してDNS応答時間が改善されることを確認しました)。

dnsmasqしかし、私が達成している効率(ヒット率など)について考えるために、キャッシュが何であるかを知りたいのですが。

マニュアルページとWebページを見ましたが、dnsmasqキャッシュの内容を表示する方法が見つかりません(たとえば、dnsmasq.leaseファイルに保存されているリース操作とは異なり)。

DNSdnsmasqキャッシュはメモリにのみ保持されますか?または、一部のログファイルを変更する必要がありますか?

ベストアンサー1

アクセス権はありませんが、タイトルによるとdnsmasq次のようになります。dnsmasqはキャッシュですか?USR1 シグナルをプロセスに送信して、dnsmasqシステムログに統計をダンプさせることができます。

$ sudo pkill -USR1 dnsmasq

次に、システムログを確認します。

$ sudo tail /var/log/syslog
Jan 21 13:37:57 dnsmasq[29469]: time 1232566677
Jan 21 13:37:57 dnsmasq[29469]: cache size 150, 0/475 cache insertions re-used unexpired cache entries.
Jan 21 13:37:57 dnsmasq[29469]: queries forwarded 392, queries answered locally 16
Jan 21 13:37:57 dnsmasq[29469]: server 208.67.222.222#53: queries sent 206, retried or failed 12
Jan 21 13:37:57 dnsmasq[29469]: server 208.67.220.220#53: queries sent 210, retried or failed 6

メモ:私はそれがdnsmasqRAMにキャッシュを保持すると信じています。

したがって、キャッシュをダンプするには、呼び出し時に-qスイッチを有効にする必要があります。マニュアルページにはdnsmasq次のものがありますdnsmasq

   -d, --no-daemon
        Debug mode: don't fork to the background, don't write a pid file, 
        don't change user id, generate a complete cache dump  on
        receipt on SIGUSR1, log to stderr as well as syslog, don't fork new 
        processes to handle TCP queries. Note that this option is for use in 
        debugging only, to stop dnsmasq daemonising in production, use -k.

   -q, --log-queries
        Log the results of DNS queries handled by dnsmasq. Enable a full 
        cache dump on receipt of SIGUSR1.

おすすめ記事