12

I'm trying to migrate a dns server that has several thousand zones loaded on it. The named.conf file has about 17 different includes, and some of those files also has includes in them, and lots of commented out etc. It's a fricking mess!

I'm wanting to get a list of all the zones currently loaded into BIND. I looked at rndc dumpdb but it doesn't show me just the zones.

Instead of following the messy include files, is there an easier way to get a list of the authorative zones inside BIND? Thanks!

14

You can run rndc dumpdb -zones to create a file called cache_dump.db. This file will contain all authoritative zones and will be created in BIND's data directory.

  • Thats what i thought too but its only showing me the reverse dns arpa zones – DuPie Jun 21 '12 at 18:22
  • I would check the log files for more information. If only the reverse ARPA zones are in the dump file, I would say that only these are loaded in the DNS server. – Vladimir Blaskov Jun 21 '12 at 18:25
  • 1
    Where is BIND's data directory? – Elgs Qian Chen Jul 15 '16 at 19:16
  • It's either /var/named or /var/named/chroot/var/named (if you're using chroot'ed BIND) on most distributions, but your mileage may vary depending on the distribution you're using. – Vladimir Blaskov Jul 17 '16 at 7:18
  • 1
    On Debian jessie the file ended in /var/cache/bind/named_dump.db – Calimo Nov 15 '16 at 12:21
2

Confirmed rndc dumpdb is the best method.

In my case, i discovered that there was 2 seperate bind instances running on the same server (don't ask), one doing forward dns and one doing reverse dns. Without specifying the PID, it attached to the one only doing reverse dns and only showed me that.

1

If you just want to have the configuration (including any include files) printed in its canonical form, you could simply call:

named-checkconf -p (optionally with -t /some/chroot/dir if BIND runs chrooted and the config needs to be read from the chroot dir)

This flattens out all the include files, removes all comments and formats everything neatly.

While the output will include statically configured zones, it will not list dynamic zones, like those added with rndc addzone.

1

Adding -all does the trick for me (on Ubuntu Ubuntu 16.04.2 LTS (xenial))

sudo rndc dumpdb -all && cat /var/cache/bind/named_dump.db
0

The following is the exact command to list the zones that are loaded during startup. This is tested on RHEL6.7 x86_64.

/usr/sbin/named-checkconf -z -t /var/named/chroot | grep loaded

Example:

[root@dnsserver ~]# /usr/sbin/named-checkconf -z -t /var/named/chroot | grep loaded
zone 0.0.127.in-addr.arpa/IN: loaded serial 2008040700
zone 19.58.10.in-addr.arpa/IN: loaded serial 2008040701
zone 11.54.10.in-addr.arpa/IN: loaded serial 2008040700
zone example.com/IN: loaded serial 2008040702
zone ./IN: loaded serial 2008040700
  • 2
    please explain more. – Sven Jan 13 '16 at 9:07
  • Please refer the edited answer. – Sasikumar K Jan 27 '16 at 4:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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