With host -a
you query for ANY
record. which is one of the special “magic” types in DNS. Instead of being a query for a single type like A , AAAA or MX, ANY retrieves all the available types for a given name.
ANY
requests are mainly a a diagnostic tool for human operators.Normally an application would make queries for only a single specific type.
There is no relevance in the order in which ANY
responses are returned.
When you query for specific record types, i.e.with host -t MX google.com
or dig -t A serverfault.com
and you get multiple responses there may indeed be a relevant effect in the order they get returned.
Nameservers and resolvers usually perform round-robin DNS when a specific query will result in multiple responses. They will vary, between one request and the next, the order in which they send those responses. Since most clients will connect to the first response they receive such variation will result in some load balancing.
A
, AAAA
, NS
(and probably others) - multiple responses are allowed and possible and round-robin DNS will happen.
For instance see what happens when you perform multiple lookups of the serverfault.com ip-address:
$ host -t A serverfault.com
serverfault.com has address 151.101.193.69 <=== 1
serverfault.com has address 151.101.1.69 <=== 2
serverfault.com has address 151.101.65.69 <=== 3
serverfault.com has address 151.101.129.69 <=== 4
$ host -t A serverfault.com
serverfault.com has address 151.101.1.69 <=== 2
serverfault.com has address 151.101.65.69 <=== 3
serverfault.com has address 151.101.129.69 <=== 4
serverfault.com has address 151.101.193.69 <=== 1
$ host -t A serverfault.com
serverfault.com has address 151.101.65.69 <=== 3
serverfault.com has address 151.101.129.69 <=== 4
serverfault.com has address 151.101.193.69 <=== 1
serverfault.com has address 151.101.1.69 <=== 2
MX
- multiple responses are allowed. The order in which the resolver returns them does usually not matter for the client, as MX
records have a priority field that defines the relative ranking of the available MX records, but multiple MX records with the same priority should result in a round-robin effect similar to that of for instance multiple A records :
_ MX preference aka priority
/
google.com. 600 IN MX 30 alt2.aspmx.l.google.com.
google.com. 600 IN MX 40 alt3.aspmx.l.google.com.
google.com. 600 IN MX 20 alt1.aspmx.l.google.com.
google.com. 600 IN MX 50 alt4.aspmx.l.google.com.
google.com. 600 IN MX 10 aspmx.l.google.com.
SOA
- only a single response is allowed, ordering is not an issue
CNAME
- only a single response is allowed (see this Q&A) , ordering is not an issue