Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to get a complete list of A and CNAME records on my BIND DNS server?

I have access to the zone files. But on my server there are lots of zone files, and it'd take too long to go over all of them by hand. Is there a command that lists this info or will I have to write a script myself?

share|improve this question
O noes! Not a script! – womble May 1 '09 at 23:59
up vote 6 down vote accepted

Rather than use grep on all of the zone files, use:

% rndc dumpdb -zones

This will create a dump of the server's authoritative data called cache_dump.db, probably in /var/named/data (or similar).

This file is easier to parse than the original zone files because every line starts with the domain name to which it applies. The raw zone files are probably abbreviated.

share|improve this answer
Perfect, that's exactly what I needed! Though the file was named named_dump.db in my case. Thanks :) – Christopher Nadeau May 2 '09 at 16:58
On Ubuntu it seems to end up in /var/cache/bind/named_dump.db – m01 Jun 27 '14 at 14:11

From your var/named/data (or equivalent directory) grep through the db.* files with an appropriate regular expression, something like:

grep '\(.  *A   *[0-9][0-9]*\)\|\(..*CNAME..*\)' db.*

Note that the final 'db.*` globs all the db files. Repeat for every directory you have zone files in.

share|improve this answer
That's what the find command is for! find /var/named/data -name 'db.*' -print0 | xargs -0 grep '...' – Chris Jester-Young May 1 '09 at 23:58

for i in my domain list; do dig -t axfr $i @localhost; done

Have to allow zone transfers from localhost first.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.