How to configure DNS resolution to send multiple simultaneous requests when resolving a name?


Several times each year my ISP's name servers stop working for whatever reason.

I want my RedHat box to overcome this efficiently.

I would prefer if every name lookup my OS makes causes multiple UDP packets to be sent out to multiple different name servers, and for the first useful reply to be the one used.

I don't really want round-robin DNS lookups, nor do I want it to wait for one to fail before trying a second one - I want to achieve fast operation by using multiple simultaneous queries.

If this can be done - how do I set it up?

I plan to use my normal ISP's name server, the name server of my ISP's ISP, and the name server of a completely unrelated ISP elsewhere - all at once.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DNS isn't designed to work that way. It will wait for the DNS server chosen to time out first before trying a second server. It wouldn't make any sense to send multiple queries at once as then it would be wasting bandwidth (from the DNS servers point of view).

The only alternative I can thin kof would be to write a script that checks every xxx minutes for a functional DNS server (from your ISP) and if it detects no response, then it will switch the DNS servers your box uses.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ChrisDrakeAuthor Commented:
I don't think this is true.

Unrelatedly, I run several DNS servers myself, and with debugging turned on I can see that almost all queries I receive arrive simultaneously at all of my name servers - so this kindof seems like the default behaviour of something (yes - I realize how "bind" or whatever resolves queries is different from how my OS's resolver does it).

Maybe if I install a caching nameserver on my own box?  Does anyone know how to configure "named" aka "bind" to behave like I described above?
I've got to agree with td_miles here, spamming multiple, flakey name servers isn't going to help the situation. Either writing a script which periodically checks that your ISP's name servers are alive, if not then 'cp resolve.backup resolve.conf' or running your own name server (maybe start by reading is a better solution.

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ChrisDrakeAuthor Commented:
Please be more careful with your language: there's no rule or ethic saying I cant send 2 UDP requests instead of just 1, nor is it your place to tell me not to.

How might you "write a script" to check a name server?  query a name every minute for no reason? well - (A) *that* is spamming, and (B) won't be a good test, since the name gets cached, so you'll get false positives - not to mention an average 30-second delay when it goes down and can be detected.

No - I'm running a high-reliability service, and I don't want a fallback solution: I want a redundant failsafe one.  I've got dual PSU's from dual power companies, dual NICs on dual ISPs, hardware RAID, all on multiple servers in 3 different countries - and I'm sick of DNS being a single point of failure every few months.
1. "I run several DNS servers myself" -- Then run another one on this server.
2. "Decades of experience in (and I've kept a list) over 100 different programming languages. " -- Then modify gethostbyname() and gethostbyaddr(),  in glibc to use the servers in /etc/resolve.conf simultaneously.

ChrisDrakeAuthor Commented:
1. I'm already running my own custom-written one so the interface isn't free to run a 2nd

2. actually, unless someone provies an answer, I'll probably write my own DNS proxy, rather than mess with glibc.  My question here was simply to see whether there's some obvious config thing I can do before wasting the time to code this solution :-)

1. (again)... you know... I guess I *could* run my own on a different interface...  (spit. now I've got to try and remember how to set up a 2nd interface...)
The DNS server could listen on the localhost if it's only to answer lookups from itself.

ChrisDrakeAuthor Commented:
Umm... my UDP's a smidge rusty... if it's listening on and my gethostbyname() asks it to resolve (say), it's going to have to ultimately query googles name servers for the IP address... so where does googles name servers send these UDP reply packets?  Isn't my DNS server going to need to be listening on an external socket to get the reply?  And what about the old DNS servers who only honor requests from port 53?
When your dns server on localhost receives a request and needs to query a remote name server to resolve it. It will send the request via the external interface but the source port will not be udp 53 therefore the reply will be directed back to bind (or whatever) and not the custom daemon.

The way to solve your problem is to run a local caching-only nameserver and specify that as the first nameserver in resolv.conf. If Bind is not configured to use a forwarder it will go directly to the root servers and recurse to the nameserver for whatever domain the query is associated with bypassing your ISP's nameservers completely.
Karl Heinz KremerCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split between td_miles, AlanBell and jlevie
Please leave any comments here within the next seven days.


EE Cleanup Volunteer

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.