Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

DNS lookup and specify DNS server to use

by g_speran (Scribe)
on Oct 11, 2021 at 16:32 UTC ( [id://11137424]=perlquestion: print w/replies, xml ) Need Help??

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11137424]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2024-04-16 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found