Question about nameserver selection mechanism

Mark Andrews Mark_Andrews at
Tue Feb 27 22:29:33 UTC 2007

> Eric Jain wrote:
> > According to DNS and BIND (5th edition) [] 
> > "BIND chooses between a number of nameservers that are authoritative for 
> > the same zone by selecting the nameserver with the lowest round-trip time."
> > 
> > Can anyone point me towards more details about how BIND gathers and 
> > maintains these statistics?

	For BIND 9 they are stored in the adb (see lib/dns/resolver.c
	and lib/dns/adb.c).

	For BIND 8 they are stored with the address record.

> > Are all nameservers queried right away, or is 
> > at most one nameserver queried for each lookup request (which would mean 
> > that the results would have to be kept in some kind of database)?
> > 
> > 
> As far as I know (and I write it here to get it clear for everyone),
> when a BIND resolver receives an answer, keeps tracks of the RTT of the
> servers queried and uses it to decide where the next query for that zone
> will be directed to.
> On the very beginning, without any information, I think the resolver
> tries every NS available, and when the "recognition process" ends uses
> the metric described above.

	No.  Named pick a server a random.  If that times out it picks
	a second, etc.  RTT estimates are built up as a side effect
	of the queries it makes.

	For one off queries it doesn't make much difference.  However
	when you look at the root, tld servers and second level
	infrastucture servers (e.g. ".", "COM", "COM.AU") named will
	workout which servers give the lower RTT and preference them.


> I remember i've seen a post on this mailing list giving a more detailed
> explanation.
> Kind Regards
> Sebastian Castro

Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at

More information about the bind-users mailing list