g_speran has asked for the wisdom of the Perl Monks concerning the following question:

currently I am using gethostbyname and gethostbyaddr. However I am looking for a way to specify the specific DNS server to validate against much like the Windows
"nslookup IP dns server"
format and dont believe that this can be done using the gethostbyname and/or gethostbyaddr. Any recommendations on how to achieve this?
  • Comment on DNS lookup and specify DNS server to use

Replies are listed 'Best First'.
Re: DNS lookup and specify DNS server to use
by ikegami (Patriarch) on Oct 11, 2021 at 16:59 UTC

    Neither gethostbyname nor gethostbyaddr make DNS requests (directly). They call the similarly named system calls. So not the right tools for multiple reasons.

    Doing a quick search for DNS gives us Net::DNS. While it doesn't allow you to specify a server, it's just a means of accessing an instance of Net::DNS::Resolver which does allow you to specify a server.

Re: DNS lookup and specify DNS server to use
by haukex (Archbishop) on Oct 11, 2021 at 17:16 UTC