We talked in this article about setting the TTLs for DNS records in BIND for the purposes of moving a website, or, more specifically, changing the IP address of an authoritative DNS server. In this article, we will show you how to turn up the logging and output the results to a file. Again, this can be quite helpful when moving authoritative DNS servers, since you can monitor all activity and know whether or not the world is looking at your server, still, for resolution. With this method, you can stick with your current system startup scripts and just change /etc/named.conf. Make sure you make a copy of named.conf first, before you do any edits. We have tested this on Red Hat 7.2 and 8.0, but this is mostly BIND 9 specific and not tied to a distribution. As always, test this in a lab environment before you go messsing with your production servers. Here is a “debug on” section of the named.conf file we created:
logging { category "default" { "debug"; }; category "general" { "debug"; }; category "database" { "debug"; }; category "security" { "debug"; }; category "config" { "debug"; }; category "resolver" { "debug"; }; category "xfer-in" { "debug"; }; category "xfer-out" { "debug"; }; category "notify" { "debug"; }; category "client" { "debug"; }; category "unmatched" { "debug"; }; category "network" { "debug"; }; category "update" { "debug"; }; category "queries" { "debug"; }; category "dispatch" { "debug"; }; category "dnssec" { "debug"; }; category "lame-servers" { "debug"; }; channel "debug" { file "/tmp/nameddbg" versions 2 size 50m; print-time yes; print-category yes; }; }; |
We inserted this on the line after the closing brace/semicolon in the options section at the top of named.conf. If you don’t have a logging section in your named.conf file, the default will log basic info. This will show up in varying places depending on your distribution’s setup. The category lines map different classes of errors to a different channel. For our purposes, we just sent everything to the debug channel. In the channle section, we defined the log file as /tmp/nameddbg. The versions statement means we keep 2 versions of the file if it goes over 50 megs. We also print the time and category of the message. Just restart named using your existing scripts after changing named.conf to get logging started, and tail -f /tmp/nameddbg to watch the queries, etc. scroll by. Remember to switch back to the original named.conf when you are done, because this is a lot of logging. For more information about configuring named.conf, see the manpage.