2 Applications Area Arnt Gulbrandsen
3 INTERNET-DRAFT Troll Technologies
4 <draft-gulbrandsen-dns-rr-srvcs-03.txt> Paul Vixie
9 Updates: RFC 1035, RFC 1183
12 A DNS RR for specifying the location of services (DNS SRV)
17 This document describes a DNS RR which specifies the location of the
18 server(s) for a specific protocol and domain (like a more general
23 This document is an Internet-Draft. Internet-Drafts are working
24 documents of the Internet Engineering Task Force (IETF), its areas,
25 and its working groups. Note that other groups may also distribute
26 working documents as Internet-Drafts.
28 Internet-Drafts are draft documents valid for a maximum of six months
29 and may be updated, replaced, or obsoleted by other documents at any
30 time. It is inappropriate to use Internet-Drafts as reference
31 material or to cite them other than as ``work in progress.''
33 To learn the current status of any Internet-Draft, please check the
34 ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
35 Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
36 munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
37 ftp.isi.edu (US West Coast).
39 Overview and rationale
41 Currently, one must either know the exact address of a server to
42 contact it, or broadcast a question. This has led to e.g.
43 ftp.whatever.com aliases, the SMTP-specific MX RR, and using MAC-
44 level broadcasts to locate servers.
46 The SRV RR allows administrators to use several servers for a single
47 domain, to move services from host to host with little fuss, and to
48 designate some hosts as primary servers for a service and others as
53 Gulbrandsen and Vixie [Page 1]
55 Expires October 1996 DNS SRV RR March 1996
58 Clients ask for a specific service/protocol for a specific domain
59 (the word domain is used here in the strict RFC 1034 sense), and get
60 back the names of any available servers.
65 When a SRV-cognizant web-browser wants to retrieve
71 _http._tcp.www.asdf.com
73 and retrieves the document from one of the servers in the reply. The
74 example zone file near the end of the draft contains answering RRs
78 The format of the SRV RR
80 Here is the format of the SRV RR, whose DNS type code is 33:
82 _Service._Proto.Name TTL Class SRV Priority Weight Port Target
84 (There is an example near the end of this document.)
87 The symbolic name of the desired service, as defined in Assigned
88 Numbers or locally. An underscore (_) is prepended to the
89 service identifier to avoid collisions with DNS labels that
92 Some widely used services, notably POP, don't have a single
93 universal name. If Assigned Numbers names the service
94 indicated, that name is the only name which is legal for SRV
95 lookups. Only locally defined services may be named locally.
96 The Service is case insensitive.
99 The symbolic name of the desired protocol, with an underscore
100 (_) prepended to prevent collisions with DNS labels that occur
101 in nature. _TCP and _UDP are at present the most useful values
102 for this field, though any name defined by Assigned Numbers or
103 locally may be used (as for Service). The Proto is case
109 Gulbrandsen and Vixie [Page 2]
111 Expires October 1996 DNS SRV RR March 1996
115 The domain this RR refers to. The SRV RR is unique in that the
116 name one searches for is not this name; the example near the end
120 Standard DNS meaning.
123 Standard DNS meaning.
126 As for MX, the priority of this target host. A client MUST
127 attempt to contact the target host with the lowest-numbered
128 priority it can reach; target hosts with the same priority
129 SHOULD be tried in pseudorandom order. The range is 0-65535.
132 Load balancing mechanism. When selecting a target host among
133 the those that have the same priority, the chance of trying this
134 one first SHOULD be proportional to its weight. The range of
135 this number is 1-65535. Domain administrators are urged to use
136 Weight 0 when there isn't any load balancing to do, to make the
137 RR easier to read for humans (less noisy).
140 The port on this target host of this service. The range is
141 0-65535. This is often as specified in Assigned Numbers but
145 As for MX, the domain name of the target host. There MUST be
146 one or more A records for this name. Implementors are urged, but
147 not required, to return the A record(s) in the Additional Data
148 section. Name compression is to be used for this field.
150 A Target of ``.'' means that the service is decidedly not
151 available at this domain.
154 Domain administrator advice
156 Asking everyone to update their telnet (for example) clients when the
157 first internet site adds a SRV RR for Telnet/TCP is futile (even if
158 desirable). Therefore SRV will have to coexist with A record lookups
159 for a long time, and DNS administrators should try to provide A
160 records to support old clients:
165 Gulbrandsen and Vixie [Page 3]
167 Expires October 1996 DNS SRV RR March 1996
170 - Where the services for a single domain are spread over several
171 hosts, it seems advisable to have a list of A RRs at the same
172 DNS node as the SRV RR, listing reasonable (if perhaps
173 suboptimal) fallback hosts for Telnet, NNTP and other protocols
174 likely to be used with this name. Note that some programs only
175 try the first address they get back from e.g. gethostbyname(),
176 and we don't know how widespread this behaviour is.
178 - Where one service is provided by several hosts, one can either
179 provide A records for all the hosts (in which case the round-
180 robin mechanism, where available, will share the load equally)
181 or just for one (presumably the fastest).
183 - If a host is intended to provide a service only when the main
184 server(s) is/are down, it probably shouldn't be listed in A
187 - Hosts that are referenced by backup A records must use the port
188 number specified in Assigned Numbers for the service.
190 Currently there's a practical limit of 512 bytes for DNS replies.
191 Until all resolvers can handle larger responses, domain
192 administrators are strongly advised to keep their SRV replies below
195 All round numbers, wrote Dr. Johnson, are false, and these numbers
196 are very round: A reply packet has a 30-byte overhead plus the name
197 of the service (``_telnet._tcp.asdf.com'' for instance); each SRV RR
198 adds 20 bytes plus the name of the target host; each NS RR in the NS
199 section is 15 bytes plus the name of the name server host; and
200 finally each A RR in the additional data section is 20 bytes or so,
201 and there are A's for each SRV and NS RR mentioned in the answer.
202 This size estimate is extremely crude, but shouldn't underestimate
203 the actual answer size by much. If an answer may be close to the
204 limit, using e.g. ``dig'' to look at the actual answer is a good
210 Weight, the load balancing field, is not quite satisfactory, but the
211 actual load on typical servers changes much too quickly to be kept
212 around in DNS caches. It seems to the authors that offering
213 administrators a way to say ``this machine is three times as fast as
214 that one'' is the best that can practically be done.
221 Gulbrandsen and Vixie [Page 4]
223 Expires October 1996 DNS SRV RR March 1996
226 The only way the authors can see of getting a ``better'' load figure
227 is asking a separate server when the client selects a server and
228 contacts it. For short-lived services like SMTP an extra step in the
229 connection establishment seems too expensive, and for long-lived
230 services like telnet, the load figure may well be thrown off a minute
231 after the connection is established when someone else starts or
232 finishes a heavy job.
237 Currently, the translation from service name to port number happens
238 at the client, often using a file such as /etc/services.
240 Moving this information to the DNS makes it less necessary to update
241 these files on every single computer of the net every time a new
242 service is added, and makes it possible to move standard services out
243 of the ``root-only'' port range on unix.
248 A SRV-cognizant client SHOULD use this procedure to locate a list of
249 servers and connect to the preferred one:
251 Do a lookup for QNAME=_service._protocol.target, QCLASS=IN,
254 If the reply is NOERROR, ANCOUNT>0 and there is at least one SRV
255 RR which specifies the requested Service and Protocol in the
258 If there is precisely one SRV RR, and its Target is ``.''
259 (the root domain), abort.
261 Else, for all such RR's, build a list of (Priority, Weight,
264 Sort the list by priority (lowest number first)
266 Create a new empty list
268 For each distinct priority level
269 While there are still elements left at this priority
271 Select an element randomly, with probability
272 Weight, and move it to the tail of the new list
277 Gulbrandsen and Vixie [Page 5]
279 Expires October 1996 DNS SRV RR March 1996
282 For each element in the new list
284 query the DNS for A RR's for the Target or use any
285 RR's found in the Additional Data secion of the
288 for each A RR found, try to connect to the (protocol,
291 else if the service desired is SMTP
293 skip to RFC 974 (MX).
297 Do a lookup for QNAME=target, QCLASS=IN, QTYPE=A
299 for each A RR found, try to connect to the (protocol,
304 - Port numbers SHOULD NOT be used in place of the symbolic service
305 or protocol names (for the same reason why variant names cannot
306 be allowed: Applications would have to do two or more lookups).
308 - If a truncated response comes back from an SRV query, and the
309 Additional Data section has at least one complete RR in it, the
310 answer MUST be considered complete and the client resolver
311 SHOULD NOT retry the query using TCP, but use normal UDP queries
312 for A RR's missing from the Additional Data section.
314 - A client MAY use means other than Weight to choose among target
315 hosts with equal Priority.
317 - A client MUST parse all of the RR's in the reply.
319 - If the Additional Data section doesn't contain A RR's for all
320 the SRV RR's and the client may want to connect to the target
321 host(s) involved, the client MUST look up the A RR(s). (This
322 happens quite often when the A RR has shorter TTL than the SRV
325 - A future standard could specify that a SRV RR whose Protocol was
326 _TCP and whose Service was _SMTP would override RFC 974's rules
327 with regard to the use of an MX RR. This would allow firewalled
328 organizations with several SMTP relays to control the load
329 distribution using the Weight field.
333 Gulbrandsen and Vixie [Page 6]
335 Expires October 1996 DNS SRV RR March 1996
338 - Future protocols could be designed to use SRV RR lookups as the
339 means by which clients locate their servers.
344 This is (part of) the zone file for asdf.com, a still-unused domain:
347 @ SOA server.asdf.com. root.asdf.com. (
348 1995032001 3600 3600 604800 86400 )
350 NS ns1.ip-provider.net.
351 NS ns2.ip-provider.net.
352 _ftp._tcp SRV 0 0 21 server.asdf.com.
353 _finger._tcp SRV 0 0 79 server.asdf.com.
354 ; telnet - use old-slow-box or new-fast-box if either is
355 ; available, make three quarters of the logins go to
357 _telnet._tcp SRV 0 1 23 old-slow-box.asdf.com.
358 SRV 0 3 23 new-fast-box.asdf.com.
359 ; if neither old-slow-box or new-fast-box is up, switch to
360 ; using the sysdmin's box and the server
361 SRV 1 0 23 sysadmins-box.asdf.com.
362 SRV 1 0 23 server.asdf.com.
363 ; HTTP - server is the main server, new-fast-box is the backup
364 ; (On new-fast-box, the HTTP daemon runs on port 8000)
365 _http._tcp SRV 0 0 80 server.asdf.com.
366 SRV 10 0 8000 new-fast-box.asdf.com.
367 ; since we want to support both http://asdf.com/ and
368 ; http://www.asdf.com/ we need the next two RRs as well
369 _http._tcp.www SRV 0 0 80 server.asdf.com.
370 SRV 10 0 8000 new-fast-box.asdf.com.
371 ; SMTP - mail goes to the server, and to the IP provider if
373 _smtp._tcp SRV 0 0 25 server.asdf.com.
374 SRV 1 0 25 mailhost.ip-provider.net.
375 @ MX 0 server.asdf.com.
376 MX 1 mailhost.ip-provider.net.
377 ; NNTP - use the IP providers's NNTP server
378 _nntp._tcp SRV 0 0 119 nntphost.ip-provider.net.
379 ; IDB is an locally defined protocol
380 _idb._tcp SRV 0 0 2025 new-fast-box.asdf.com.
382 server A 172.30.79.10
383 old-slow-box A 172.30.79.11
384 sysadmins-box A 172.30.79.12
385 new-fast-box A 172.30.79.13
389 Gulbrandsen and Vixie [Page 7]
391 Expires October 1996 DNS SRV RR March 1996
394 ; backup A records - new-fast-box and old-slow-box are
395 ; included, naturally, and server is too, but might go
396 ; if the load got too bad
400 ; backup A RR for www.asdf.com
402 ; NO other services are supported
406 In this example, a telnet connection to ``asdf.com.'' needs an SRV
407 lookup of ``_telnet._tcp.asdf.com.'' and possibly A lookups of ``new-
408 fast-box.asdf.com.'' and/or the other hosts named. The size of the
409 SRV reply is approximately 365 bytes:
411 30 bytes general overhead
412 20 bytes for the query string, ``_telnet._tcp.asdf.com.''
413 130 bytes for 4 SRV RR's, 20 bytes each plus the lengths of ``new-
414 fast-box'', ``old-slow-box'', ``server'' and ``sysadmins-box'' -
415 ``asdf.com'' in the query section is quoted here and doesn't
416 need to be counted again.
417 75 bytes for 3 NS RRs, 15 bytes each plus the lengths of
418 ``server'', ``ns1.ip-provider.net.'' and ``ns2'' - again, ``ip-
419 provider.net.'' is quoted and only needs to be counted once.
420 120 bytes for the 6 A RR's mentioned by the SRV and NS RR's.
425 RFC 1918: Y. Rekhter, R. Moskowitz, D. Karrenberg, G. de Groot, E.
426 Lear, ``Address Allocation for Private Internets'', 02/29/1996.
428 RFC 1916 H. Berkowitz, P. Ferguson, W. Leland, P. Nesser,
429 ``Enterprise Renumbering: Experience and Information
430 Solicitation'', 02/28/1996.
432 RFC 1912 D. Barr, ``Common DNS Operational and Configuration
433 Errors'', 02/28/1996.
435 RFC 1900: B. Carpenter, Y. Rekhter, ``Renumbering Needs Work'',
438 RFC 1880: J. Postel, ``INTERNET OFFICIAL PROTOCOL STANDARDS'',
441 RFC 1814: E. Gerich, ``Unique Addresses are Good'', 06/22/1995.
445 Gulbrandsen and Vixie [Page 8]
447 Expires October 1996 DNS SRV RR March 1996
450 RFC 1794: T. Brisco, ``DNS Support for Load Balancing'', 04/20/1995.
452 RFC 1713: A. Romao, ``Tools for DNS debugging'', 11/03/1994.
454 RFC 1712: C. Farrell, M. Schulze, S. Pleitner, D. Baldoni, ``DNS
455 Encoding of Geographical Location'', 11/01/1994.
457 RFC 1706: B. Manning, R. Colella, ``DNS NSAP Resource Records'',
460 RFC 1700: J. Reynolds, J. Postel, ``ASSIGNED NUMBERS'', 10/20/1994.
462 RFC 1183: R. Ullmann, P. Mockapetris, L. Mamakos, C. Everhart, ``New
463 DNS RR Definitions'', 10/08/1990.
465 RFC 1101: P. Mockapetris, ``DNS encoding of network names and other
468 RFC 1035: P. Mockapetris, ``Domain names - implementation and
469 specification'', 11/01/1987.
471 RFC 1034: P. Mockapetris, ``Domain names - concepts and facilities'',
474 RFC 1033: M. Lottor, ``Domain administrators operations guide'',
477 RFC 1032: M. Stahl, ``Domain administrators guide'', 11/01/1987.
479 RFC 974: C. Partridge, ``Mail routing and the domain system'',
483 Security Considerations
485 The authors believes this RR to not cause any new security problems.
486 Some problems become more visible, though.
488 - The ability to specify ports on a fine-grained basis obviously
489 changes how a router can filter packets. It becomes impossible
490 to block internal clients from accessing specific external
491 services, slightly harder to block internal users from running
492 unautorised services, and more important for the router
493 operations and DNS operations personnel to cooperate.
495 - There is no way a site can keep its hosts from being referenced
496 as servers (as, indeed, some sites become unwilling secondary
497 MXes today). This could lead to denial of service.
501 Gulbrandsen and Vixie [Page 9]
503 Expires October 1996 DNS SRV RR March 1996
506 - With SRV, DNS spoofers can supply false port numbers, as well as
507 host names and addresses. The authors do not see any practical
510 We assume that as the DNS-security people invent new features, DNS
511 servers will return the relevant RRs in the Additional Data section
512 when answering an SRV query.
519 Postboks 6133 Etterstad
525 Mail: agulbra@troll.no
532 Phone: (415) 747-0204
557 Gulbrandsen and Vixie [Page 10]