Stanford::DNSserver - A DNS Name Server Framework for Perl

Stanford::DNSserver is an extensive rewrite of the DNS name server code from the original lbnamed. On its way to becoming a module the code was sanitized and modernized. Various patches and suggestions that rolled in over the years were applied and put to good use. The result is a module that's easy to use for implementing lbnamed or any other perl-powered DNS server. Grab the tarball today.

Converting your classic lbnamed to Stanford::DNSserver is easy. Your existing lbnamed.conf will be the new main program. Copy it to a new file and make the following changes:

Use the new module to get the goodies necessary to build a name server.

use Stanford::DNS;
use Stanford::DNSserver;
Generate a new name server object.

$ns = new Stanford::DNSserver
        (
          listen_on =>   [$hostname],
          pidfile   => "lbnamed.pid",
          logfunc   =>       \&logit,
          loopfunc  =>     \&refresh,
          exitfunc  =>     \&cleanup
        );
Change the LBDB:: calls to Stanford::DNSserver object method invocations. For example, this

LBDB::add_dynamic("lb.stanford.edu" => \&handle_lb_request);
LBDB::add_static("localhost.lb.stanford.edu",T_A,rr_A(0x7f000001));
becomes this:

$ns->add_dynamic("lb.stanford.edu" => \&handle_lb_request);
$ns->add_static("localhost.lb.stanford.edu",T_A,rr_A(0x7f000001));
Finally, start the name server.

$ns->answer_queries();
That's all there is to it! Share and enjoy.
Last modified: April 8, 2006