There is no order in the DNS which is why we say there are record sets, instead of saying record lists.
But your question is vague and depends of the record type. For SRV and MX records for example, there is an order, depending on various parameters in the record.
For A or AAAA record type that you may be thinking about, you get back (potentially) a set of records. Of course they come in some order, if you analyze the network traffic for example. But the order is not set at all, and can be different each time you query, and this is made on purpose.
What the client should do in case of multiple IP addresses for example depends on the application and the client. Browsers for example may try all IP addresses one by one, using the order they got, until they found out which one replies.
But there are other cases, like RFC 8305 Happy Eyeballs Version 2: Better Connectivity Using Concurrency, where it is explained how to favor IPv6 while still giving users a good experience, so in short trying both the IPv6 and IPv4 addresses (for dual stacked hosts obviously) with a slight preference over IPv6.
If you have multiple records that are responsive to a DNS request, the DNS server itself returns them in an unpredictable order. This is by design and is known as round robin DNS. Typically the client will only use the first record returned, but it could use more than one of the records if programmed to try them in turn, e.g. if a connection attempt fails.
There is no order in the DNS which is why we say there are record sets, instead of saying record lists.
But your question is vague and depends of the record type. For
SRV
andMX
records for example, there is an order, depending on various parameters in the record.For
A
orAAAA
record type that you may be thinking about, you get back (potentially) a set of records. Of course they come in some order, if you analyze the network traffic for example. But the order is not set at all, and can be different each time you query, and this is made on purpose.What the client should do in case of multiple IP addresses for example depends on the application and the client. Browsers for example may try all IP addresses one by one, using the order they got, until they found out which one replies.
But there are other cases, like RFC 8305 Happy Eyeballs Version 2: Better Connectivity Using Concurrency, where it is explained how to favor IPv6 while still giving users a good experience, so in short trying both the IPv6 and IPv4 addresses (for dual stacked hosts obviously) with a slight preference over IPv6.
If you have multiple records that are responsive to a DNS request, the DNS server itself returns them in an unpredictable order. This is by design and is known as round robin DNS. Typically the client will only use the first record returned, but it could use more than one of the records if programmed to try them in turn, e.g. if a connection attempt fails.