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

Im trying to get the packet of sending a any request to a domain from a DNS server. Now Net::DNS::packet is Perfect for me. yet i dont know how to format the request. so far i have tried:
my $dnspacket = new Net::DNS::Packet(8.8.8.8, 'ANY', 'IN', 'vmware.com');
I have tried replacing the arguments around, no results.. The packet sends, but the result is not right.

Replies are listed 'Best First'.
Re: Testing Nameserver with domain Net::DNS::Packet
by taint (Chaplain) on May 24, 2014 at 20:23 UTC
    Greetings. This looks nearly identical to another post, just a few posts down. Yours also?

    What "packets" are you looking to send/receive? Given the terse example you provide. It looks like you're only looking for the IN A. The DNS is a protocol, and has rules that must be followed, to properly form correct queries. I strongly recommend learning more about it. As that knowledge will be required to create, and send, as well as knowing what format to expect on return "packets". DNSwatch appears to be a fairly good resource for much of this.

    You'll need to setup "queries" in your script/application --
    IN (A|AAA|MBOX|NS|SOA|RP|LOC|CNAME|PTR|TXT|SPF|IXFR|AXFR) (to name but a few), if you're looking to make more than one type. If you're on a UNIX-ish system. Try dig, and experiment to learn how to correctly form the queries "packets". While this may seem obvious, I'll ask anyway. Have you looked at the examples provided in Net::DNS? I found the examples were easily used, and modified to suite my own needs.

    If you could provide a slightly more specific example of what you wanted, or even a slightly more specific question. It'd be easier to form a specific solution.

    Best wishes.

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH