Hi,

you have several options:

1. loop over an array of hostnames and resolve them each with a call 
gethostbyname

2. use Net::DNS and do a named xfer for the domain all the servers are in 
and afterwards grep through the results for the hosts you actually need.

       Perform a zone transfer and print all the records.

         use Net::DNS;
         $res = new Net::DNS::Resolver;
         $res->nameservers("ns.foo.com");
         @zone = $res->axfr("foo.com");
         foreach $rr (@zone) {
             $rr->print;
         }
Net::DNS is nice, but needs some reading. But it would solve the "query 
once and filter output" approach you prefer. gethostbyname is easier to 
program, but you will see one DNS query for each host.

Best regards,
Oliver

Am Dienstag, 5. März 2002 16:23 schrieb [EMAIL PROTECTED]:
> Using PERL, how do I dump all the DNS entries of a nameserver?
>
> REASON:
> Given a set of host IPS, I want to come up with a table of IP vrs
> hostname. I am currently in a DNS environment, so /etc/hosts is of no
> use.  Instead of querying DNS for each IP (using nslookup), I want to
> query the DNS server once, and then use the output to obtain what I want.
>
> The language of implementation is PERL, so if anyone has a legacy script
> they will want to share with me, I will appreciate it.  Also any pointers
> will be appreciated.
>
>
> __________________
>
> William Ampeh (x3939)
> Federal Reserve Board

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to