digでDNSの名前解決時間を調べる

DNS の名前解決時間をdig(1) コマンドで調べる。

$ dig @dns_server name

@dns_server を指定しなければ /etc/resolv.conf で設定した DNS サーバが利用される。

$ dig @8.8.8.8 www.amazon.com

; <<>> DiG 9.8.1-P1 <<>> @8.8.8.8 www.amazon.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15920
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.amazon.com.                        IN      A

;; ANSWER SECTION:
www.amazon.com.         39      IN      A       176.32.98.166

;; Query time: 46 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Nov 16 17:18:07 2013
;; MSG SIZE  rcvd: 48

出力結果にある行 ;; Query time: 46 msec が欲しい情報

$ dig @8.8.8.8 www.amazon.com | grep Query
;; Query time: 41 msec

キャッシュサーバでキャッシュされる前後で名前解決の時間がどのように変わるか確認

# before cache
$ dig @192.168.5.3 www.amazon.com | grep Query
;; Query time: 117 msec
# after cache
$ dig @192.168.5.3 www.amazon.com | grep Query
;; Query time: 1 msec

なお 8.8.8.8Google Public DNS

via : http://serverfault.com/questions/91063/how-do-i-benchmark-performance-of-external-dns-lookups

Advertisements
Tagged with: ,
Posted in linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
%d bloggers like this: