NAME
Net::DNS::Utility - Perl extension that provides some basic DNS utility functions. At this time most are related to IPv6.
SYNOPSIS
use Net::DNS::Utility;
DESCRIPTION
Net-DNS-Utility provides some basic functionality for the creation and management of DNS data. Many of the routines at this time are focused on IPv6.
new() Create a new Net::DNS::Utility object.
my $dnsUtil = new Net::DNS::Utility();
new(STRING) Create a new Net::DNS::Utility object.
my $dnsUtil = new Net::DNS::Utility("2001:0db8:abcd:1234::1/64");
STRING is an IPv6 address and prefix length.
addressLength() This function is used to set the address/length attibute of this object. This would be used to override the address/length attribute that is set when constructed or if no address/length was supplied when the object was constructed. Address/length passed in or if no argument specified currently set address/length attribute is returned as a string.
my $dnsUtil = new Net::DNS::Utility(); $dnsUtil->addressLength("2001:0db8::/32");
loadDebug() Accepts a Debug.pm object to facilitate initializa- tion of the debugging
use Debug; use Net:DNS::Utility;
my $debug = new Debug; my $IPv6Address = new Net::IPv6Address(); $IPv6Address->loadDebug($debug);
Debug.pm is a copy of valid Debug.pm object
createIp6ReverseZone(STRING1, STRING2) Accepts two strings one prefix and one prefix length. A string representation of the valid reverse zone is returned as a string. The prefix must be fully uncompressed to ensure creation of a proper IPv6 reverse zone.
Net::IPv6Address can be used to facilitate the generation of a properly formatted prefix and prefix length for use with this function.
use Net::IPv6Address; use Net::DNS::Utility; use Debug;
my $prefix = "2001:0db8:1234:5678:90ef:0000:0000:ffff"; my $prefixlen = 64;
my $debug = new Debug(); my $dnsUtil = new Net::DNS::Utility(); my $IPv6address = new Net::IPv6Address($prefix, $prefixlen);
$dnsUtil->loadDebug($debug); my $ip6reverse = $dnsUtil->createIp6ReverseZone($IPv6address->prefix, $IPv6address->addressLength);
createBindNamedConf(STRING1, STRING2, STRING3) Used to create the stanza required for the provided IPv6 reverze zone. Output is written to STDOUT.
STRING1 is the IPv6 reverse zone, STRING2 is the prefix, and STRING3 is the prefix length.
my $prefix = "2001:0db8:1234:5678:90ef:0000:0000:ffff"; my $prefixlen = 64;
my $debug = new Debug(); my $dnsUtil = new Net::DNS::Utility(); my $IPv6address = new Net::IPv6Address($prefix, $prefixlen);
my $ip6reverse = $dnsUtil->createIp6ReverseZone($IPv6address->prefix, $IPv6address->addressLength); $dnsUtil->createBindNamedConf($ip6reverse, $IPv6address->prefix, $IPv6address->addressLength);
createBindNamedDb(STRING1, STRING2, STRING3) Used to create an exmaple BIND DB file for the supplied IPv6 reverse zone. A file is created with an automatically generated file name based on prefix and prefix length.
STRING1 is the IPv6 reverse zone, STRING2 is the prefix, and STRING3 is the prefix length.
my $prefix = "2001:0db8:1234:5678:90ef:0000:0000:ffff"; my $prefixlen = 64;
my $debug = new Debug(); my $dnsUtil = new Net::DNS::Utility(); my $IPv6address = new Net::IPv6Address($prefix, $prefixlen);
my $ip6reverse = $dnsUtil->createIp6ReverseZone($IPv6address->prefix, $IPv6address->addressLength); $dnsUtil->createBindNamedDb($ip6reverse, $IPv6address->prefix, $IPv6address->addressLength);
createPtrData(STRING1) Used to generate the interface portion of a PTR record based on prefix and prefix length that have been provided. A string is returned.
STRING1 is the interface identifier portion of the IPv6 address.
my $prefix = "2001:0db8:1234:5678:90ef:0000:0000:ffff"; my $prefixlen = 64;
my $debug = new Debug(); my $dnsUtil = new Net::DNS::Utility(); my $IPv6address = new Net::IPv6Address($prefix, $prefixlen);
$dnsUtil->createPtrData($IPv6address->interface);
EXPORT
None by default.
SEE ALSO
N/A
AUTHOR
JJMB, <jjmb@jjmb.com>
COPYRIGHT AND LICENSE
Copyright (C) 2008 by JJMB
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.