root server query question

Mark de Vries markdv.bind at asphyx.net
Fri Apr 29 15:24:39 UTC 2005


On Thu, 28 Apr 2005 Christopher.Lee at uboc.com wrote:

>
> Hello,
>
> Thanks.  Should have known to look in CPAN you can find everything there.
> I already have a simple script working.  :-)
>
> One question about how this works behind the screen.  I just want to make
> sure it is doing this correctly...
>
> If I do a query to get the NS records like so:
>
> use Net::DNS;
> my $res   = Net::DNS::Resolver->new(Verbose => 1);
> my $query = $res->query("uboc.com", "NS");
>
> if ($query) {
>     foreach $rr (grep { $_->type eq 'NS' } $query->answer) {
>         print $rr->nsdname, "\n";
>     }
> } else {
>     warn "query failed: ", $res->errorstring, "\n";
> }
>
> It appears that it is getting this information from my name servers and not
> from the root servers because I know we have some differences right now

Yes, unless you tell it to do otherwise, it's using whatever you have in
/etc/resolv.conf.

When writing a script to solve the same problem once I just got a list of
root servers from the default ones (resolv.conf) and then just do the
iterative process (from root down) 'manually' in the script.

I tried to find the code but failed so I can't send it to you :(

I do remeber one little 'gotcha'; some server returned the info I needed
in the answer section, others in the auth section. Remember to look at
both when checking if your query returned any 'answers'.

Good luck,
Mark.



More information about the bind-users mailing list