Name server debugging can be started either from the command line or with signals. If you need to see the startup information to diagnose your current problem, you'll have to use the command-line option. If you want to start debugging on a name server that is already running, or if you want to turn off debugging, you'll have to use signals. The name server writes its debugging output to named.run. A BIND 4 name server will create named.run in /usr/tmp (or /var/tmp). A BIND 8 name server will create named.run in the name server's current directory.
When troubleshooting, you sometimes need to see the sort list, know which interface a file descriptor is bound to, or find out where in the initialization stage the name server was when it exited (if the syslog error message wasn't clear enough). To see this kind of debugging information, you'll have to start debugging with a command-line option; by the time you send a signal, it will be too late. The command-line option for debugging is -d level. When you use the command-line option to turn on debugging, a BIND 4 name server will not go into the background as it does normally; you'll have to add the "&" at the end of your command line to get your shell prompt back. Here's how to start the name server at debugging level 1:
#/etc/named -d 1 &
If you don't need to see the name server initialization, start your name server without the debugging command-line option. You can later turn debugging on and off by sending the USR1 and USR2 signals to the name server process. The first USR1 signal causes named to start writing debugging output at level 1. Each subsequent USR1 signal increases the debugging level by 1. Send USR2 to turn off debugging. Here, we set debugging to level 3, then turn debugging off:
#kill -USR1 `cat /etc/named.pid`
- Level 1 #kill -USR1 `cat /etc/named.pid`
- Level 2 #kill -USR1 `cat /etc/named.pid`
- Level 3 #kill -USR2 `cat /etc/named.pid`
- Off
And, as you might expect, if you turn on debugging from the command line, you can still send USR1 and USR2 signals to the name server.