Signal processing is one area in which the version of BIND matters. BIND 8 and earlier versions of BIND handle several different signals. BIND 9 handles only two: SIGHUP and SIGTERM. Under BIND 9, SIGHUP reloads the DNS database, and SIGTERM terminates the named process. You can use signals with BIND 8, but don't use signals with BIND 9. Control BIND 9 with rndc, which is covered in the next section. That said, BIND 8 accepts the following signals.
The SIGHUP signal causes named to reread the named.conf file and reload the name server database. Using SIGHUP causes the reload to occur immediately. On a master server, this means that the local database files are reloaded into memory. On a slave server, this means that the slave immediately reloads its local disk copies and then sends a query to the master server for the SOA record to check if there is a new configuration.
SIGINT causes named to dump its cache to named_dump.db. The dump file contains all of the domain information that the local name server knows. Examine this file. You'll see a complete picture of the information the server has learned. Examining the cache is an interesting exercise for anyone who is new to DNS.
Use SIGUSR1 to turn on tracing. Each subsequent SIGUSR1 signal increases the level of tracing. Trace information is written to named.run. Tracing can also be enabled with the -d option on the named command line if the problem you are looking for occurs so early in the startup that the SIGUSR1 signal is not useful. The advantage of SIGUSR1 is that it allows tracing to be turned on when a problem is suspected, without stopping and restarting named.
The opposite of SIGUSR1 is SIGUSR2. It turns off tracing and closes the trace file. After issuing SIGUSR2, you can examine the file or remove it if it is getting too large.
The kill command is used to send a signal to a running process. As the name implies, by default it sends the kill signal. To use it to send a different signal, specify the signal on the command line. For example, specify -INT to send the SIGINT signal. The process ID (PID) must be provided on the kill command line to ensure that the signal is sent to the correct process.
You can learn the process ID by using the ps command or using the status argument with the / etc/init.d/named script. For example:
271 ? S 0:00 /usr/sbin/named 7138 p0 S 0:00 grep named
In the case of named, you can learn the process ID by listing the named.pid file:
$ cat /var/run/named/named.pid
Combining some of these commands, you can send a signal directly to named. For example, to reload the name server, you could enter the following command:
kill -HUP 'cat /var/run/named/named.pid'
The cat /var/run/named/named.pid command that is enclosed in single quotes is processed by the shell first. On our sample system, this returns the PID 271. That is combined with the kill command and then is processed as kill -HUP 271. This works, but it is easier to use the named management tools that come with BIND.
Was this article helpful?