The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::DNSServer::DBI - SQL backend for resolving DNS queries

SYNOPSIS

  #!/usr/bin/perl -w
  use strict;
  use Net::DNSServer;
  use Net::DNSServer::DBI;

  my $dbi_resolver = new Net::DNSServer::DBI {
    connect => [ dbi connect args ... ],
    default_ttl => "3600",
    default_serial => "2002040100",
    default_nameservers => [ qw(ns.isp.com) ],
  };

  run Net::DNSServer {
    priority => [ $dbi_resolver ],
  };

DESCRIPTION

This resolver translates a DNS query into an SQL query. The answer from the SQL server is translated back into a DNS response and sent to the DNS client.

This module requires an external database server to be running and the DBI / DBD::* API Interface to the SQL database server to be installed. The external database server may run on the same machine as the name server, (localhost), or it may run on a separate machine or database cluster for increased scalability and/or fault tolerance.

new

The new() method takes a hash ref of properties.

connect (required)

This is a hash ref of arguments that will be passed to DBI->connect() to initiate the connection to the database which must yield a valid database handle.

This field is required.

default_ttl (optional)

This is the $DEFAULT_TTL that will be used in case a zone template does not contain its own.

If none is supplied, it defaults to 86400.

default_serial (optional)

This is the serial number to be used for those in the "soa" table with NULL for serial.

If none is supplied, it defaults to today:

date +"%Y%m%d00"

default_nameservers (optional)

This is an array ref of name servers to be used for all entries that have %NS% in the "soa" table. The first element of this array is also considered the primary SOA server.

If none is supplied, the fully qualified domain of the hostname is used:

hostname --fqdn

along with its complement name server computed based on the hostname. i.e., "ns1.isp.com" will also add "ns2.isp.com" to this setting.

EXAMPLE

See demo/mysql/README packaged with this distribution for a working example using the MySQL database server as its SQL backend.

AUTHOR

Rob Brown, rob@roobik.com

SEE ALSO

DBI, Net::DNSServer, Net::DNSServer::Base,

COPYRIGHT

Copyright (c) 2002, Rob Brown. All rights reserved.

Net::DNSServer is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

$Id: DBI.pm,v 1.3 2002/04/29 10:50:31 rob Exp $