howto know if a query was delegated to cache

Feng He shorttag at gmail.com
Mon Jul 25 13:33:50 UTC 2011


You may have been confused about what should be cached and what should
not be cached.

This is an answer which is coming from the authoritative server and
which is not a cached response:


$ dig www.google.com @ns1.google.com

; <<>> DiG 9.6-ESV-R4 <<>> www.google.com @ns1.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32616
;; flags: qr aa rd; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

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

;; ANSWER SECTION:
www.google.com.         604800  IN      CNAME   www.l.google.com.
www.l.google.com.       300     IN      A       74.125.127.106
www.l.google.com.       300     IN      A       74.125.127.103
www.l.google.com.       300     IN      A       74.125.127.104
www.l.google.com.       300     IN      A       74.125.127.99
www.l.google.com.       300     IN      A       74.125.127.105
www.l.google.com.       300     IN      A       74.125.127.147

;; Query time: 54 msec
;; SERVER: 216.239.32.10#53(216.239.32.10)
;; WHEN: Mon Jul 25 21:28:29 2011
;; MSG SIZE  rcvd: 148




This is a cached answer from a public cache server:

$ dig www.google.com @8.8.8.8

; <<>> DiG 9.6-ESV-R4 <<>> www.google.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27179
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
www.google.com.         86399   IN      CNAME   www.l.google.com.
www.l.google.com.       299     IN      A       74.125.53.105
www.l.google.com.       299     IN      A       74.125.53.106
www.l.google.com.       299     IN      A       74.125.53.104
www.l.google.com.       299     IN      A       74.125.53.147
www.l.google.com.       299     IN      A       74.125.53.99
www.l.google.com.       299     IN      A       74.125.53.103

;; Query time: 51 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Jul 25 21:28:42 2011
;; MSG SIZE  rcvd: 148




Have you seen the flags? the first has an "aa" flag set, while the
second doesn't have. Instead it has a "ra" flag set. Sorry for my
before post to write wrong with "rr" flag.

Regards.



More information about the bind-users mailing list