DNS::TinyDNS::dnsserver - Perl extension for manipulating dnsserver from djbdns
use DNS::TinyDNS; # First create the object my $dnsserver = DNS::TinyDNS->new(type => 'dnsserver', dir => '/service/tinydns'); # Get zones @zones = $dnsserver->list_zones; # Get one zone $zone = $dnsserver->get_zone($zones[0]); # Add entry $dnsserver->add(zone => $zones[0], type => 'ns', host => 'anarion.7a69ezine.org', ttl => 84500, ); # Modify ip where tinydns listens $dnsserver->set_env( IP => '10.0.0.1' ); $dnsserver->restart;
This module will allow you to manipulate djbdns dnsserver files.
You can set/get the this vars:
IP ROOT
For further information about every var, consult djbdns server documentation at http://cr.yp.to/
http://cr.yp.to/
This method returns a list of all the diferent zones configured
my @zones = $dnsserver->list_zones;
This method returns a list of hashes with all records of one zone. The keys of the hash deppends on the type of the record
my @zone_e = $dnsserver->get_zone('catalunya.cat');
The hash have the following keys:
type => String showing the type of the record ('ns','host','mx','alias','reverse') ttl => ttl of the record ip => ip of the host host => host is only set with ns or mx records priority => is only set with mx records
This method return an array of hashes with all records of one type. Posible types are: mx, ns, host, alias, reverse or all
my @mxs = $dnsserver->list(type => 'mx' , zone => '7a69ezine.org');
This method adds a mx record
$dnsserver->add(zone => '7a69ezine.org', type => 'mx', ip => '10.0.0.1', host => 'rivendel.7a69ezine.org', pref => 10, ttl => 84500, );
This method adds a ns record
$dnsserver->add(zone => '7a69ezine.org', type => 'ns', ip => '10.0.0.1', host => 'rivendel.7a69ezine.org', ttl => 84500, );
This method adds a host record
$dnsserver->add(zone => '7a69ezine.org', type => 'host', ip => '10.0.0.1', host => 'rivendel', ttl => 84500, );
This method adds a alias record
$dnsserver->add(zone => '7a69ezine.org', type => 'alias', cname=> 'www.7a69ezine.org', host => 'rivendel', ttl => 84500, );
This method add a reverse dns record
$dnsserver->add(zone => '7a69ezine.org', type => 'reverse', host => 'anarion', ip => '10.0.0.13', );
This method delete a mx record
$dnsserver->del(zone => '7a69ezine.org', type => 'mx', ip => '10.0.0.1', host => 'rivendel.7a69ezine.org', pref => 10, );
This method delete a ns record
$dnsserver->del(zone => '7a69ezine.org', type => 'ns', ip => '10.0.0.1', host => 'rivendel.7a69ezine.org', );
This method delete a host record
$dnsserver->del(zone => '7a69ezine.org', type => 'host', host => 'rivendel', ip => '10.0.0.1', );
This method delete a alias record
$dnsserver->del(zone => '7a69ezine.org', type => 'alias', host => 'rivendel', cname=> 'www.7a69ezine.org', );
This method delete a reverse dns record
$dnsserver->del(type => 'reverse', ip => '10.0.0.13', );
If you want to change from named to bind you can use to methods:
Allow bind to transfer the zones from localhost:
perl -lne 'system "tcpclient 127.0.0.1 53 axfr-get $1 zona-$1 zona-$1.tmp" if /zone[^"]+"([^"]+)"/' /home/named/etc/named.conf
Use DNS::ZoneParse and DNS::TinyDNS::dnsserver.
Anarion: anarion@7a69ezine.org
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DNS::TinyDNS::dnscache. DNS::TinyDNS.
12 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
=back without =over
To install DNS::TinyDNS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DNS::TinyDNS
CPAN shell
perl -MCPAN -e shell install DNS::TinyDNS
For more information on module installation, please visit the detailed CPAN module installation guide.