Answer the question
In order to leave comments, you need to log in
How do you get a response to a DNS query for an SRV record?
I’m a little confused, please help me figure out if an SRV request is sent for a domain such as example.com and this domain has several srv records with different priorities and weights, my question is that how the dns server will respond to this request will send all SRV records regardless of priority and weight and dns the client himself will choose having sorted out by priority and weight? or the dns server itself will send the answer one by one, sorted by priority and weight? Ps: a similar question applies to the MX record
I would be very grateful!
Answer the question
In order to leave comments, you need to log in
host -t mx google.com
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
dig google.com mx +short
20 alt1.aspmx.l.google.com.
30 alt2.aspmx.l.google.com.
50 alt4.aspmx.l.google.com.
10 aspmx.l.google.com.
40 alt3.aspmx.l.google.com.
The DNS server always returns all records of the requested type for a given name, including all MX/SRV records.
The _client_ selects the MX with the minimum weight, in case of its unavailability or a non-fatal sending error - with a higher weight, and so on, if several mx have the same weight - the order between them is chosen randomly. Therefore, the client needs all MX records. Approximately the same with SRV, but there the priority is provided by the priority order and within the same priority the choice between hosts is made randomly, the probability distribution is given by weight. Those. all hosts with the minimum priority are taken and a random one is selected among them, but not equally likely, but in accordance with the weight (for example, if one has a weight of 100 and the other has 200, then the probability of choosing the second one is twice as high). Plus, the client can also consider alternatives between different services (for example, between _smtp._tcp and _smtps._tcp) or give preference to a specific port or network.
On the server side, only round robin can be implemented - random mixing of records, while mixing weights and priorities are not taken into account. round robin is required by the standard, but in fact it is not done by everyone, for example, Google resolvers (which are 8.8.8.8) do not do it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question