Полезная информация

DNS & BIND

DNS & BINDSearch this book
Previous: 12.4 The Resolver Search Algorithm and Negative CachingChapter 12
Reading BIND Debugging Output
Next: 13. Troubleshooting DNS and BIND
 

12.5 Tools

Let's wrap up a few loose ends. We told you about a tool to convert IP addresses to names so that your debugging output is easier to read. Here is such a tool written in Perl:

#!/usr/bin/perl

use "Socket.pm";
while(< >) {
  if(/\b)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\b/) {
      $addr = pack('C4', split(/\./, $1));
      ($name, $rest) = gethostbyaddr($addr, &AF_INET);
      if($name) {s/$1/$name/; }

    print;
}

It's best not to pipe named.run output into this script with debugging on, because the script will generate its own queries to the name server.

If you do any significant amount of name server debugging, you'll want a tool to turn debugging on and off. The 4.9 and later BIND distributions include a tool called ndc, which can be used for this purpose. The command ndc trace will turn on debugging, or increment the debug level if debugging is already on. The command ndc notrace will turn debugging off.


Previous: 12.4 The Resolver Search Algorithm and Negative CachingDNS & BINDNext: 13. Troubleshooting DNS and BIND
12.4 The Resolver Search Algorithm and Negative CachingBook Index13. Troubleshooting DNS and BIND