[dns-operations] good async DNS library

Doug Barton dougb at dougbarton.email
Fri Apr 26 03:04:20 UTC 2019

On 4/25/19 2:08 PM, Klaus Darilion wrote:
> Hi all!
> For various monitoring scripts we use Perl's NET::DNS and 
> Net::DNS::Async. Unfortunately they have various problems, ie 
> Net::DNS::Async does not support DNSSEC and sending to other ports than 
> 54, with Net::DNS's timeout/retries settings I never get the expected 
> results ....
> Can someon recommend a DNS library (Perl, Python or PHP preferred) that 
> supports:
> - async resolving
> - setting DO bit
> - EDNS0 options
> - proper timeout handling
> - sending queries to non-standard ports
> - (optional: TCP fallback)

Maybe if you sent your queries to port 53 you'd have better results?  ;)

Seriously though, it would be easier to help if you talked about what 
you're trying to accomplish, rather than starting out with a proposed 
solution. Also, please define what you mean by async, and why you think 
you need it. (I know those may sounds like dumb questions, but it will 
be easier to help you if you answer them.)

I have done a fair bit with both Perl and Net::DNS(::SEC), and while it 
has a lot of warts, they are improving with the recent few years of 
active maintenance. The timeout/retry code tends to do what it should 
do, whether that's what you intended or not. If you have a requirement 
for stricter timeouts and/or predictable retries you'd be better off 
using Net::DNS::Packet, and use Perl's IO::Socket module to send; rather 
than using any of the pre-baked methods for queries in Net::DNS. I 
combine that with alarms in situations where I need stricter timeouts, 
retries with progressive backoff, etc. That said, do enough of that work 
yourself and it will make you more appreciative of some of the oddities 
of what Net::DNS is doing.

hope this helps,


More information about the dns-operations mailing list