Flylib.com

Books Software

 
 
 

5.4 Viewing a Name Server s Cache


5.4 Viewing a Name Server's Cache

5.4.1 Problem

You want to view a name server's cached data.

5.4.2 Solution

Use rndc dumpdb (BIND 9) or ndc dumpdb (BIND 8) to dump the cache to disk, then look through the dump file.

5.4.3 Discussion

BIND 9 name servers only dump the contents of the cache to disk by default, but BIND 8 name servers dump both the contents of cache and authoritative zone data to disk, so you'll have to find the cached records in the file.

To determine which records in a BIND 8 database dump were cached, look at the TTLs and the contents of the comment field. Authoritative zone data will have the nice, round TTLs you configured, while cached records will have had their TTLs decremented by the number of seconds they've been in the cache. Cached records will also have "Cr=" as a comment at the end of the record, giving the credibility level of the record (an indication of the quality of the cached record). For example, these records were cached from an authoritative response from the name server at 128.9.0.107:

.       518380  IN      NS      I.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      E.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      D.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      A.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      H.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      C.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      G.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      F.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      B.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      J.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      K.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      L.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]
        518380  IN      NS      M.ROOT-SERVERS.NET.     ;Cr=auth [128.9.0.107]

Remember that dumping the cache to disk has no effect on the contents of the cache. If you want to flush (clear) the cache, see Recipe Section 5.5.

5.4.4 See Also

Section 5.5 and "Controlling the Name Server" in Chapter 7 of DNS and BIND .


5.5 Flushing (Clearing) a Name Server's Cache

5.5.1 Problem

You want to flush bad records from a name server's cache.

5.5.2 Solution

If you run a BIND 9.2.0 or newer name server, you can flush the cache with rndc flush . With older name servers, you need to kill the name server and restart it to flush the cache. You can do that in one fell swoop with rndc restart or rndc exec .

5.5.3 Discussion

Clearing the cache is really a side effect of killing the name server, since BIND name servers only store cached data in memory. Since restarting the name server takes time, especially if the name server is authoritative for many zones, rndc flush is a better option.

If you run multiple views on your BIND 9.2.0 or newer name server, you can flush the cache in only one view using rndc flush viewname . For example:

# rndc flush internal

BIND 9.3.0 will support flushing all of the records attached to a particular domain name with rndc flushname . For example:

# rndc flushname cnn.com

5.5.4 See Also

Section 5.10 for restarting a name server with the same command-line options.