AW: ipv6 PTR in zone file

John Wobus jw354 at cornell.edu
Fri Apr 15 14:56:00 UTC 2011


> pint> use Net::IP
> pint> $foo = new Net::IP '2001:db8::42'
> 3
> pint> $foo->reverse_ip()
> 2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d. 
> 0.1.0.0.2.ip6.arpa.
> pint>

Or you could just dash off the simple perl expression to do the job:

my $ptr = do {
     my($head,$tail) =
       map { join '', map { sprintf '%04s',$_; } split /:/,$_; }
       split /::/, $addr  . '::', 3;
     my $hex32 = '0' x 32;
     substr( $hex32, 0, length($head) ) = $head;
     substr( $hex32, 32, -length($tail) ) =  $tail;
     join '.', ( reverse split //, $hex32 ), 'ip6.arpa';
     };


John



More information about the bind-users mailing list