Previous Page
Next Page

13.6. Tools

Let's wrap up loose ends. We told you about our 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 -n

use "Socket";

if (/\b)(\d+\.\d+\.\d+\.\d+)\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 nameserver.


Previous Page
Next Page