Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I perform a bulk DNS query using perl on Unix/Linux?

Tags:

unix

perl

dns

I have a list of systems for which I'm trying to get IP addresses. I've successfully used the Net::DNS module for perl to perform an IP address query for a single hostname. I have 1,000 systems, however, that I need ip addresses for.

Is there a way to get all of these ip addresses with a single query?

If not, is there a way to get the entire DNS entry list, say, for a single domain? If I got that, then I could simply put that into a hash and reference the IP addresses that way.

like image 424
wsaxton Avatar asked Dec 13 '22 08:12

wsaxton


1 Answers

No need for custom Perl. This can be done using the -f option to dig (part of the BIND tools):

$ dig -f /path/to/host-list.txt
like image 182
frezik Avatar answered Mar 01 '23 23:03

frezik