Net::DNSServer::DBI - SQL backend for resolving DNS queries
#!/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 ], };
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.
The new() method takes a hash ref of properties.
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.
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.
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"
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.
See demo/mysql/README packaged with this distribution for a working example using the MySQL database server as its SQL backend.
Rob Brown, rob@roobik.com
DBI, Net::DNSServer, Net::DNSServer::Base,
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 $
To install Net::DNSServer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DNSServer
CPAN shell
perl -MCPAN -e shell install Net::DNSServer
For more information on module installation, please visit the detailed CPAN module installation guide.