NAME
DNS::TinyDNS::dnsserver - Perl extension for manipulating dnsserver from djbdns
SYNOPSIS
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;
DESCRIPTION
This module will allow you to manipulate djbdns dnsserver files.
FUNCTIONS
get_env/set_env
You can set/get the this vars:
IP
ROOT
For further information about every var, consult djbdns server documentation at http://cr.yp.to/
list_zones
This method returns a list of all the diferent zones configured
my @zones = $dnsserver->list_zones;
get_zone
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
list
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');
add
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',
);
del
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',
);
NOTE
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.
AUTHOR
Anarion: anarion@7a69ezine.org
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
DNS::TinyDNS::dnscache. DNS::TinyDNS.
12 POD Errors
The following errors were encountered while parsing the POD:
- Around line 46:
You forgot a '=back' before '=head2'
- Around line 48:
=back without =over
- Around line 60:
You forgot a '=back' before '=head2'
- Around line 62:
=back without =over
- Around line 70:
You forgot a '=back' before '=head2'
- Around line 72:
=back without =over
- Around line 90:
You forgot a '=back' before '=head2'
- Around line 92:
=back without =over
- Around line 102:
You forgot a '=back' before '=head2'
- Around line 104:
=back without =over
- Around line 156:
You forgot a '=back' before '=head2'
- Around line 158:
=back without =over