in reply to How can I determine all the hosts on my network?

What you need to do is perform a zone transfer and extract all of the A records for the domain in question.

#!/usr/bin/perl use Net::DNS; use Socket; use strict; my $domain = shift || "foo.com"; # Create a resolver object my $res = new Net::DNS::Resolver; # Ask the local resolver what the name servers for the domain in # question. my @ns; my $query = $res->query($domain, "NS") or die "query failed; ". $res->errorstring; for my $rr ($query->answer) { next if $rr->type ne "NS"; my $dotted_quad = join(".", (unpack("C4", gethostbyname($rr->nsdname)))); print "Found name server ".$rr->nsdname." ($dotted_quad)\n"; push @ns, $dotted_quad; } $res->nameservers(@ns); # ok, now we do a zone transfer my @zoneinfo = $res->axfr($domain) or die "query failed; ". $res->errorstring; # now loop through the answers and print those that are A records for my $rr (@zoneinfo) { next if $rr->type ne "A"; print "Found ". $rr->name ." A ".$rr->address."\n"; }

An alternative method might be to process the output of the "nslookup" or "dig" commands.