RFC 2782
A DNS RR for specifying the location of services (DNS SRV)
RFC 2782 π
A DNS RR for specifying the location of services (DNS SRV) πΈ
Authors: A. Gulbrandsen (Troll Technologies), P. Vixie (Internet Software Consortium), and L. Esibov (Microsoft Corp.) π
Category: Standards Track π¦
Date: February 2000 π
Obsoletes: RFC 2052 π§
Status of This Memo β¨
This document specifies an Internet standards track protocol for the Internet community, and it's literally asking for discussion and suggestions for improvements π«Ά Check the current "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice π
Copyright (C) The Internet Society (2000). All Rights Reserved.
Abstract π¦
This document describes a DNS RR which specifies the location of the server(s) for a specific protocol and domain.
Overview and rationale π
Right now, you either have to know the exact address of a server to contact it, or you have to broadcast a question and hope π
The SRV RR is giving main character energy π It lets admins use several servers for a single domain, move services from host to host with very little fuss, and designate some hosts as primary servers for a service while others are backups π₯
Clients ask for a specific service and protocol for a specific domain (the word domain is used here in the strict RFC 1034 sense), and they get back the names of any available servers π
Note that where this document refers to "address records", it means A RR's, AAAA RR's, or their most modern equivalent β¨
Definitions π
The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT" and "MAY" used in this document are to be interpreted as specified in [BCP 14]. Other terms used in this document are defined in the DNS specification, RFC 1034 π
Applicability Statement πΈ
Generally speaking, SRV records are expected to be used by clients for applications where the relevant protocol specification says clients should use the SRV record π That specification MUST define the symbolic name to be used in the Service field of the SRV record, as described below. It also MUST include security considerations, no cap π₯ Service SRV records SHOULD NOT be used in the absence of such a specification π
Introductory example π§
If a SRV-cognizant LDAP client wants to discover an LDAP server that supports the TCP protocol and provides LDAP service for the domain example.com., it does a lookup of:
_ldap._tcp.example.com
as described in [ARM] π¦ The example zone file near the end of this memo contains answering RRs for an SRV query β¨
Note: LDAP is only used as an example for illustrative purposes. The LDAP examples in this document should NOT be treated as a definitive statement on the recommended way for LDAP to use SRV records. As the applicability section explained earlier, consult the appropriate LDAP documents for the recommended procedures π
The format of the SRV RR π
Here's the format of the SRV RR, whose DNS type code is 33 π
_Service._Proto.Name TTL Class SRV Priority Weight Port Target
(There is an example near the end of this document π )
Service π·
This is the symbolic name of the desired service, as defined in Assigned Numbers [STD 2] or locally. An underscore (_) is prepended to the service identifier, so it doesn't collide with DNS labels that show up in nature π
Some widely used services, notably POP, don't have a single universal name. If Assigned Numbers names the service indicated, that name is the only name which is legal for SRV lookups π The Service is case insensitive π«Ά
Proto π¦
This is the symbolic name of the desired protocol, with an underscore (_) prepended so it doesn't collide with DNS labels that occur in nature. _TCP and _UDP are currently the most useful values for this field, though any name defined by Assigned Numbers or locally may be used (same as Service) β¨ The Proto is case insensitive π
Name π§
This is the domain this RR refers to. The SRV RR is unique in that the name you search for is NOT this name, and the example near the end shows this really clearly π
TTL π
Standard DNS meaning [RFC 1035] π
Class πΈ
Standard DNS meaning [RFC 1035] π SRV records occur in the IN Class π₯
Priority π
This is the priority of this target host. A client MUST attempt to contact the target host with the lowest-numbered priority it can reach. Target hosts with the same priority SHOULD be tried in an order defined by the weight field π«Ά The range is 0-65535. This is a 16 bit unsigned integer in network byte order β¨
Weight π
This is a server selection mechanism. The weight field specifies a relative weight for entries with the same priority. Larger weights SHOULD be given a proportionately higher probability of being selected π The range of this number is 0-65535. This is a 16 bit unsigned integer in network byte order π Domain administrators SHOULD use Weight 0 when there isn't any server selection to do, which makes the RR easier for humans to read (less noisy) π When there are records with weights greater than 0, records with weight 0 should have a very small chance of being selected π¦
In the absence of a protocol whose specification calls for other weighting information, a client arranges the SRV RRs of the same Priority in the order in which the target hosts, specified by the SRV RRs, will be contacted. The following algorithm SHOULD be used to order the SRV RRs of the same priority π§
- To select a target to be contacted next, arrange all SRV RRs (that have not been ordered yet) in any order, except that all those with weight 0 are placed at the beginning of the list.
- Compute the sum of the weights of those RRs, and with each RR associate the running sum in the selected order.
- Choose a uniform random number between 0 and the sum computed (inclusive), and select the RR whose running sum value is the first in the selected order which is greater than or equal to the random number selected.
- The target host specified in the selected SRV RR is the next one to be contacted by the client. Remove this SRV RR from the set of unordered SRV RRs, and apply the described algorithm to the unordered SRV RRs to select the next target host.
- Continue the ordering process until there are no unordered SRV RRs. This process is repeated for each Priority. π
Port πΈ
This is the port on this target host of this service. The range is 0-65535. This is a 16 bit unsigned integer in network byte order. It's often the port specified in Assigned Numbers, but it doesn't need to be π
Target π
This is the domain name of the target host. There MUST be one or more address records for this name, and the name MUST NOT be an alias (in the sense of RFC 1034 or RFC 2181) π₯ Implementors are urged, but not required, to return the address record(s) in the Additional Data section π«Ά Unless and until future standards action permits it, name compression is not to be used for this field π
A Target of "." means that the service is decidedly not available at this domain π
The "Weight" field π
Okay bestie, Weight is the server selection field, and ngl it's not perfect π Real server load changes way too fast to sit in DNS caches. So the authors figured the best you can practically do is let admins say "this machine is three times as fast as that one" ποΈπ¨
The only way to get a "better" load number is to ask a separate server at the moment the client picks a server and connects. For short-lived services, that extra step feels like too much overhead π ββοΈ For long-lived services, the number could be totally wrong a minute after you connect, because someone else just started or finished a heavy job. Chaotic π
Note: There are currently various experiments at providing relative network proximity estimation, available bandwidth estimation, and similar services. Use of the SRV record with such facilities, and in particular the interpretation of the Weight field when these facilities are used, is for further study. Weight is only intended for static, not dynamic, server selection. Using SRV weight for dynamic server selection would require assigning unreasonably short TTLs to the SRV RRs, which would limit the usefulness of the DNS caching mechanism, thus increasing overall network load and decreasing overall reliability. Server selection via SRV is only intended to express static information such as "this server has a faster CPU than that one" or "this server has a much better network connection than that one".
So the vibe is: static only π§ Weight is for "this box has a faster CPU" energy, not live load tracking. Dynamic stuff with SRV would mean super tiny TTLs, which would wreck DNS caching and make the whole network busier and less reliable π©
The Port number π
Right now, turning a service name into a port number happens on the client, often by looking it up in a file like /etc/services.
Moving that info into the DNS is iconic, because you don't have to update those files on every single computer on the net each time a new service shows up π It also makes it possible to move standard services out of the "root-only" port range on unix. Main character energy for ports π¦
Usage rules π
A SRV-cognizant client SHOULD use this procedure to find a list of servers and connect to the preferred one:
Do a lookup for QNAME=_service._protocol.target, QCLASS=IN,
QTYPE=SRV.
If the reply is NOERROR, ANCOUNT>0 and there is at least one
SRV RR which specifies the requested Service and Protocol in
the reply:
If there is precisely one SRV RR, and its Target is "."
(the root domain), abort.
Else, for all such RR's, build a list of (Priority, Weight,
Target) tuples
Sort the list by priority (lowest number first)
Create a new empty list
For each distinct priority level
While there are still elements left at this priority
level
Select an element as specified above, in the
description of Weight in "The format of the SRV
RR" Section, and move it to the tail of the new
list
For each element in the new list
query the DNS for address records for the Target or
use any such records found in the Additional Data
section of the earlier SRV response.
for each address record found, try to connect to the
(protocol, address, service).
else
Do a lookup for QNAME=target, QCLASS=IN, QTYPE=A
for each address record found, try to connect to the
(protocol, address, service)
Notes π
- Port numbers SHOULD NOT be used in place of the symbolic service or protocol names. The reason is the same one variant names can't be allowed: applications would have to do two or more lookups π ββοΈ
- If a truncated response comes back from an SRV query, the rules described in [RFC 2181] shall apply.
- A client MUST parse all of the RR's in the reply. No skipping, bestie π
- If the Additional Data section doesn't contain address records for all the SRV RR's, and the client may want to connect to the target host(s) involved, the client MUST look up the address record(s). This happens quite often when the address record has a shorter TTL than the SRV or NS RR's π«
- Future protocols could be designed to use SRV RR lookups as the means by which clients locate their servers. β¨
Fictional example π§
This example uses a fictional service called "foobar" to help you understand SRV records. If "foobar" ever actually gets implemented, it is not intended that it will necessarily use SRV records. Here's (part of) the zone file for example.com, a still-unused domain π
$ORIGIN example.com.
@ SOA server.example.com. root.example.com. (
1995032001 3600 3600 604800 86400 )
NS server.example.com.
NS ns1.ip-provider.net.
NS ns2.ip-provider.net.
; foobar - use old-slow-box or new-fast-box if either is
; available, make three quarters of the logins go to
; new-fast-box.
_foobar._tcp SRV 0 1 9 old-slow-box.example.com.
SRV 0 3 9 new-fast-box.example.com.
; if neither old-slow-box or new-fast-box is up, switch to
; using the sysdmin's box and the server
SRV 1 0 9 sysadmins-box.example.com.
SRV 1 0 9 server.example.com.
server A 172.30.79.10
old-slow-box A 172.30.79.11
sysadmins-box A 172.30.79.12
new-fast-box A 172.30.79.13
; NO other services are supported
*._tcp SRV 0 0 0 .
*._udp SRV 0 0 0 .
So in this example, a client of "foobar" in the "example.com." domain needs an SRV lookup of "_foobar._tcp.example.com." and possibly A lookups of "new-fast-box.example.com." and/or the other hosts named. The SRV reply is about 365 bytes, broken down like this:
- 30 bytes general overhead
- 20 bytes for the query string, "_foobar._tcp.example.com."
- 130 bytes for 4 SRV RR's, 20 bytes each plus the lengths of "new-fast-box", "old-slow-box", "server" and "sysadmins-box". "example.com" in the query section is quoted here and doesn't need to be counted again.
- 75 bytes for 3 NS RRs, 15 bytes each plus the lengths of "server", "ns1.ip-provider.net." and "ns2". Again, "ip-provider.net." is quoted and only needs to be counted once.
- 120 bytes for the 6 address records (assuming IPv4 only) mentioned by the SRV and NS RR's.
IANA Considerations ποΈ
The IANA has assigned RR type value 33 to the SRV RR. No other IANA services are required by this document.
Changes from RFC 2052 π
This document obsoletes RFC 2052. The big change from that previous, experimental, version is that protocol and service labels now get an underscore in front, to lower the chances of an accidental clash with a similar name used for something unrelated π«Ά Aside from that, the changes are only meant to make the document clearer and more complete. This document especially clarifies how the Weight field of SRV records is used.
Security Considerations π¨
The authors believe this RR does not cause any new security problems. Some problems become more visible, though, and this part is serious bestie, so read closely π
- The ability to specify ports on a fine-grained basis obviously changes how a router can filter packets. It becomes impossible to block internal clients from accessing specific external services, slightly harder to block internal users from running unauthorized services, and more important for the router operations and DNS operations personnel to cooperate.
- There is no way a site can keep its hosts from being referenced as servers. This could lead to denial of service. π±
- With SRV, DNS spoofers can supply false port numbers, as well as host names and addresses. Because this vulnerability already exists with names and addresses, this is not a new vulnerability, merely a slightly extended one, with little practical effect.
Yes, the DNS spoofing part is a whole thing, but the authors say it's basically the same vibe as before, just a little more extended π
References π
STD 2: Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC
1700, October 1994.
RFC 1034: Mockapetris, P., "Domain names - concepts and facilities",
STD 13, RFC 1034, November 1987.
RFC 1035: Mockapetris, P., "Domain names - Implementation and
Specification", STD 13, RFC 1035, November 1987.
RFC 974: Partridge, C., "Mail routing and the domain system", STD
14, RFC 974, January 1986.
BCP 14: Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
RFC 2181: Elz, R. and R. Bush, "Clarifications to the DNS
Specification", RFC 2181, July 1997.
RFC 2219: Hamilton, M. and R. Wright, "Use of DNS Aliases for Network
Services", BCP 17, RFC 2219, October 1997.
BCP 14: Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
ARM: Armijo, M., Esibov, L. and P. Leach, "Discovering LDAP
Services with DNS", Work in Progress.
KDC-DNS: Hornstein, K. and J. Altman, "Distributing Kerberos KDC and
Realm Information with DNS", Work in Progress.
Acknowledgements π«Ά
The algorithm used to select from the weighted SRV RRs of equal priority is adapted from one supplied by Dan Bernstein. Shoutout to Dan π
Authors' Addresses ποΈ
Arnt Gulbrandsen
Troll Tech
Waldemar Thranes gate 98B
N-0175 Oslo, Norway
Fax: +47 22806380
Phone: +47 22806390
EMail: arnt@troll.no
Paul Vixie
Internet Software Consortium
950 Charter Street
Redwood City, CA 94063
Phone: +1 650 779 7001
Levon Esibov
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
EMail: levone@microsoft.com
Full Copyright Statement βοΈ
Copyright (C) The Internet Society (2000). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement π
Funding for the RFC Editor function is currently provided by the Internet Society. β¨
π¦ where this page comes from
- ietf: rfc2782 2000-02
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms