RFC 2052
A DNS RR for specifying the location of services (DNS SRV)
RFC 2052: A DNS RR for specifying the location of services (DNS SRV) โจ
okay bestie, this is RFC 2052 ๐ It's an Experimental doc from October 1996, written by A. Gulbrandsen of Troll Technologies and P. Vixie of Vixie Enterprises. It's giving DNS upgrade energy, because it Updates: 1035, 1183 ๐ฆ So it's adding to the DNS rules those two already set up. Obsessed. ๐
Status of this Memo
ok so this memo defines an Experimental Protocol for the Internet community ๐งช It does NOT specify an Internet standard of any kind, so don't go calling it official ๐ They want feedback and suggestions for improvement, and distribution of this memo is unlimited โจ
Abstract
this doc describes a DNS RR ๐ that tells you where the server(s) for a specific protocol and domain live. Think of it as a more general form of MX ๐
Overview and rationale
rn you've gotta either already know the exact address of a server to contact it, or shout a question out to everyone and hope someone answers ๐ฃ That's how we ended up with things like ftp.whatever.com aliases, the SMTP-specific MX RR, and using MAC-level broadcasts to find servers. It's a lot, no cap ๐
The SRV RR is the glow-up ๐ธ It lets admins use several servers for a single domain, move services from host to host with little fuss, and label some hosts as primary servers for a service with others as backups ๐
Clients ask for a specific service/protocol for a specific domain (the word domain is used here in the strict RFC 1034 sense ๐ค) and get back the names of any available servers โจ
Introductory example
so picture a SRV-cognizant web-browser ๐ that wants to retrieve
http://www.asdf.com/
it does a lookup of
http.tcp.www.asdf.com
and then grabs the document from one of the servers in the reply ๐ฆ The example zone file near the end of the memo has the answering RRs for this query, so go peek at it later ๐
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 or locally ๐
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 that's legal for SRV lookups ๐ซ Only locally defined services may be named locally. Service is case insensitive ๐
Proto
TCP and UDP are, at present, the most useful values for this field ๐ But any name defined by Assigned Numbers or locally can be used (same as Service). Proto is case insensitive too โจ
Name
this is the domain this RR refers to. The SRV RR is unique because the name you search for is NOT this name ๐ The example near the end shows this super clearly ๐ธ
TTL
standard DNS meaning ๐
Class
standard DNS meaning ๐
Priority
just like MX, 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 pseudorandom order ๐ฒ The range is 0-65535.
Weight
this is the load balancing mechanism โ๏ธ When picking a target host among those with the same priority, the chance of trying this one first SHOULD be proportional to its weight ๐ The range of this number is 1-65535. Domain admins are urged to use Weight 0 when there isn't any load balancing to do, which makes the RR easier for humans to read (less noisy) ๐ง โจ
Port
this is the port on this target host for this service ๐ The range is 0-65535. It's often what Assigned Numbers says, but it doesn't have to be ๐ฆ
Target
just like MX, this is the domain name of the target host ๐ฏ There MUST be one or more A records for this name. Implementors are urged, but not required, to return the A record(s) in the Additional Data section ๐ Name compression is to be used for this field ๐ง
A Target of "." means the service is decidedly NOT available at this domain ๐ not it, bestie ๐
Domain administrator advice
ok real talk: asking everyone to update their telnet (for example) clients when the first internet site adds a SRV RR for Telnet/TCP is futile, even if it's desirable ๐ญ So SRV is going to have to coexist with A record lookups for a long time, and DNS admins should try to provide A records to support old clients ๐ซถ
- Where the services for a single domain are spread over several hosts, it seems advisable to have a list of A RRs at the same DNS node as the SRV RR. These list reasonable (if perhaps suboptimal) fallback hosts for Telnet, NNTP and other protocols likely to be used with this name. Note that some programs only try the first address they get back from e.g. gethostbyname(), and we don't know how widespread this behaviour is ๐ค
- Where one service is provided by several hosts, you can either provide A records for all the hosts (in which case the round-robin mechanism, where available, will share the load equally โ๏ธ) or just for one (presumably the fastest ๐๏ธ).
- If a host is intended to provide a service only when the main server(s) is/are down, it probably shouldn't be listed in A records ๐ โโ๏ธ
- Hosts that are referenced by backup A records must use the port number specified in Assigned Numbers for the service ๐
Currently there's a practical limit of 512 bytes for DNS replies ๐ Until all resolvers can handle larger responses, domain admins are strongly advised to keep their SRV replies below 512 bytes. Bestie, this one's important ๐จ
All round numbers, wrote Dr. Johnson, are false, and these numbers are very round ๐ A reply packet has a 30-byte overhead plus the name of the service ("telnet.tcp.asdf.com" for instance). Each SRV RR adds 20 bytes plus the name of the target host. Each NS RR in the NS section is 15 bytes plus the name of the name server host. And finally, each A RR in the additional data section is 20 bytes or so, and there are A's for each SRV and NS RR mentioned in the answer ๐งฎ This size estimate is extremely crude, but it shouldn't underestimate the actual answer size by much. If an answer may be close to the limit, using e.g. "dig" to look at the actual answer is a good idea ๐๐
The "Weight" field
ok so Weight, the load balancing field, is not quite satisfactory ๐ฌ The actual load on typical servers changes way too quickly to be kept around in DNS caches. The authors think offering admins a way to say "this machine is three times as fast as that one" is the best that can practically be done ๐๏ธ๐จ
The only way the authors can see of getting a "better" load figure is asking a separate server when the client selects a server and contacts it. For short-lived services like SMTP, an extra step in connection establishment seems too expensive ๐ธ And for long-lived services like telnet, the load figure may well be thrown off a minute after the connection is established, when someone else starts or finishes a heavy job ๐
The Port number
rn the translation from service name to port number happens at the client, often using a file like /etc/services ๐
Moving this info to the DNS makes it less necessary to update these files on every single computer on the net every time a new service is added ๐โจ It also makes it possible to move standard services out of the "root-only" port range on unix ๐ฆ main character era of port numbers ๐
Fictional example โจ
okay so this is (part of) the zone file for asdf.com ๐ , a domain that's still totally unused ๐ธ and literally just vibing:
$ORIGIN asdf.com.
@ SOA server.asdf.com. root.asdf.com. (
1995032001 3600 3600 604800 86400 )
NS server.asdf.com.
NS ns1.ip-provider.net.
NS ns2.ip-provider.net.
ftp.tcp SRV 0 0 21 server.asdf.com.
finger.tcp SRV 0 0 79 server.asdf.com.
; telnet - use old-slow-box or new-fast-box if either is
; available, make three quarters of the logins go to
; new-fast-box.
telnet.tcp SRV 0 1 23 old-slow-box.asdf.com.
SRV 0 3 23 new-fast-box.asdf.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 23 sysadmins-box.asdf.com.
SRV 1 0 23 server.asdf.com.
; HTTP - server is the main server, new-fast-box is the backup
; (On new-fast-box, the HTTP daemon runs on port 8000)
http.tcp SRV 0 0 80 server.asdf.com.
SRV 10 0 8000 new-fast-box.asdf.com.
; since we want to support both http://asdf.com/ and
; http://www.asdf.com/ we need the next two RRs as well
http.tcp.www SRV 0 0 80 server.asdf.com.
SRV 10 0 8000 new-fast-box.asdf.com.
; SMTP - mail goes to the server, and to the IP provider if
; the net is down
smtp.tcp SRV 0 0 25 server.asdf.com.
SRV 1 0 25 mailhost.ip-provider.net.
@ MX 0 server.asdf.com.
MX 1 mailhost.ip-provider.net.
; NNTP - use the IP providers's NNTP server
nntp.tcp SRV 0 0 119 nntphost.ip-provider.net.
; IDB is an locally defined protocol
idb.tcp SRV 0 0 2025 new-fast-box.asdf.com.
; addresses
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
; backup A records - new-fast-box and old-slow-box are
; included, naturally, and server is too, but might go
; if the load got too bad
@ A 172.30.79.10
A 172.30.79.11
A 172.30.79.13
; backup A RR for www.asdf.com
www A 172.30.79.10
; NO other services are supported
*.tcp SRV 0 0 0 .
*.udp SRV 0 0 0 .
So in this example, a telnet connection to asdf.com. first needs an SRV lookup of telnet.tcp.asdf.com. ๐ง and then maybe A lookups of new-fast-box.asdf.com. and/or the other hosts named. The SRV reply comes out to roughly 365 bytes ๐, and here's how that adds up:
- 30 bytes of general overhead
- 20 bytes for the query string,
telnet.tcp.asdf.com. - 130 bytes for 4 SRV RRs ๐ฆ: 20 bytes each, plus the lengths of
new-fast-box,old-slow-box,serverandsysadmins-box. (asdf.comin the query section is quoted here, so no need to count it again.) - 75 bytes for 3 NS RRs: 15 bytes each, plus the lengths of
server,ns1.ip-provider.net.andns2. (Again,ip-provider.net.is quoted and only needs to be counted once. ๐) - 120 bytes for the 6 A RRs mentioned by the SRV and NS RRs.
Refererences ๐
- RFC 1918: Rekhter, Y., Moskowitz, R., Karrenberg, D., de Groot, G., and E. Lear, "Address Allocation for Private Internets", RFC 1918, February 1996.
- RFC 1916: Berkowitz, H., Ferguson, P, Leland, W. and P. Nesser, "Enterprise Renumbering: Experience and Information Solicitation", RFC 1916, February 1996.
- RFC 1912: Barr, D., "Common DNS Operational and Configuration Errors", RFC 1912, February 1996.
- RFC 1900: Carpenter, B., and Y. Rekhter, "Renumbering Needs Work", RFC 1900, February 1996.
- RFC 1920: Postel, J., "INTERNET OFFICIAL PROTOCOL STANDARDS", STD 1, RFC 1920, March 1996.
- RFC 1814: Gerich, E., "Unique Addresses are Good", RFC 1814, June 1995.
- RFC 1794: Brisco, T., "DNS Support for Load Balancing", April 1995.
- RFC 1713: Romao, A., "Tools for DNS debugging", November 1994.
- RFC 1712: Farrell, C., Schulze, M., Pleitner, S., and D. Baldoni, "DNS Encoding of Geographical Location", RFC 1712, November 1994.
- RFC 1706: Manning, B. and R. Colella, "DNS NSAP Resource Records", RFC 1706, October 1994.
- RFC 1700: Reynolds, J., and J. Postel, "ASSIGNED NUMBERS", STD 2, RFC 1700, October 1994.
- RFC 1183: Ullmann, R., Mockapetris, P., Mamakos, L., and C. Everhart, "New DNS RR Definitions", RFC 1183, November 1990.
- RFC 1101: Mockapetris, P., "DNS encoding of network names and other types", RFC 1101, April 1989.
- RFC 1035: Mockapetris, P., "Domain names - implementation and specification", STD 13, RFC 1035, November 1987.
- RFC 1034: Mockapetris, P., "Domain names - concepts and facilities", STD 13, RFC 1034, November 1987.
- RFC 1033: Lottor, M., "Domain administrators operations guide", RFC 1033, November 1987.
- RFC 1032: Stahl, M., "Domain administrators guide", RFC 1032, November 1987.
- RFC 974: Partridge, C., "Mail routing and the domain system", STD 14, RFC 974, January 1986.
Security Considerations ๐
The authors believe this RR does not cause any new security problems ๐ซถ, but some problems become way more visible, and that part is serious. Here's the tea:
- 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 unauthorised 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 (as, indeed, some sites become unwilling secondary MXes today). This could lead to denial of service. ๐จ
- With SRV, DNS spoofers can supply false port numbers, as well as host names and addresses. The authors do not see any practical effect of this.
We assume that as the DNS-security people invent new features, DNS servers will return the relevant RRs in the Additional Data section when answering an SRV query. ๐ฅ
Authors' Addresses ๐
Arnt Gulbrandsen
Troll Tech
Postboks 6133 Etterstad
N-0602 Oslo
Norway
Phone: +47 22646966
EMail: agulbra@troll.no
Paul Vixie
Vixie Enterprises
Star Route 159A
Woodside, CA 94062
Phone: (415) 747-0204
EMail: paul@vix.com
๐ฆ where this page comes from
- ietf: rfc2052 1996-10
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms