How do nameservers do failover? What decides the order in which nameservers are queried when the primary nameserver is not reachable?
To illustrate, here's part of my zonefile:
$TTL 3m;
site.com. IN SOA ns1.sitese.com. admin.site.com. (
2007010403 ; Serial
1800 ; Refresh [1h=3600] 1800=30m
600 ; Retry [10m]
86400 ; Expire [2weeks] 86400=1day
180 ) ; Negative Cache TTL [1h]
;
site.com. IN NS ns1.sitese.com.
site.com. IN NS ns2.sitese.com.
site.com. IN NS ns3.sitese.com.
ns1.sitese.com. IN A 199.168.35.23
ns2.sitese.com. IN A 38.124.113.106
ns3.sitese.com. IN A 38.128.98.213
Obviously the primary nameserver is ns1.sitese.com as it is listed in the SOA record. But which one becomes the secondary nameserver if the primary is unreachable? Is it ns2, or ns3? What decides the order in which secondary nameservers are queried? Is it the order in which they appear in the zonefile? Is it something else?
AFAIK the order in which NSs are queried is up to the client. Even if your primary is up, a client can elect to query the secondary, if it feels so inclined.
From a client standpoint, all RRs returned by either the secondary or primary NSs are equivalent as all of them are marked as authoritative.
They do not.
Downstream servers just select one. If that does not answer another one. I am not sure there is a definitive spec how those are selected - so at the end, that is an implementation detail.