Anarion > DNS-TinyDNS > DNS::TinyDNS::dnsserver

Download:
DNS-TinyDNS-0.22.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.22   Source  

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.

syntax highlighting: