Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: IPV6 support for DNS lookup

by VinsWorldcom (Prior)
on Aug 05, 2014 at 13:44 UTC ( [id://1096288]=note: print w/replies, xml ) Need Help??


in reply to IPV6 support for DNS lookup

Agree with aitap above, IPv6 requires a query type of "AAAA". Your script has much bigger problems since it doesn't work at all. The following worked for me (Windows 7 x64 / Strawberry 5.18.1 MSWin32-x64-multi-thread):

use strict; use warnings; use Net::DNS; my $res = Net::DNS::Resolver->new(debug=>0, igntc=>1, recurse=>1, retrans=>0, retry=>1 ); $res->nameservers("8.8.8.8"); my %result_set = (); my $query = Net::DNS::Packet->new("www.google.com", "AAAA"); my $response = $res->send($query); if ($response->header->ancount > 0) { foreach my $rr ($response->answer) { if ($rr->type eq "AAAA") { $result_set{$rr->address} = 1; } } } use Data::Dumper; print Dumper \%result_set;

Producing:

VinsWorldcom@C:\Users\VinsWorldcom\tmp> test.pl $VAR1 = { '2607:f8b0:4006:803:0:0:0:1010' => 1 };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1096288]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-20 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found