Debian Codegraph @

rfc2052.html

raw
1 <pre>Network Working Group A. Gulbrandsen
2 Request for Comments: 2052 Troll Technologies
3 Updates: <a href="./rfc1035">1035</a>, <a href="./rfc1183">1183</a> P. Vixie
4 Category: Experimental Vixie Enterprises
5 October 1996
6
7
8 <span class="h1">A DNS RR for specifying the location of services (DNS SRV)</span>
9
10 Status of this Memo
11
12 This memo defines an Experimental Protocol for the Internet
13 community. This memo does not specify an Internet standard of any
14 kind. Discussion and suggestions for improvement are requested.
15 Distribution of this memo is unlimited.
16
17 Abstract
18
19 This document describes a DNS RR which specifies the location of the
20 server(s) for a specific protocol and domain (like a more general
21 form of MX).
22
23 Overview and rationale
24
25 Currently, one must either know the exact address of a server to
26 contact it, or broadcast a question. This has led to, for example,
27 ftp.whatever.com aliases, the SMTP-specific MX RR, and using MAC-
28 level broadcasts to locate servers.
29
30 The SRV RR allows administrators to use several servers for a single
31 domain, to move services from host to host with little fuss, and to
32 designate some hosts as primary servers for a service and others as
33 backups.
34
35 Clients ask for a specific service/protocol for a specific domain
36 (the word domain is used here in the strict <a href="./rfc1034">RFC 1034</a> sense), and get
37 back the names of any available servers.
38
39 Introductory example
40
41 When a SRV-cognizant web-browser wants to retrieve
42
43 <a href="http://www.asdf.com/">http://www.asdf.com/</a>
44
45 it does a lookup of
46
47 http.tcp.www.asdf.com
48
49
50
51
52 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 1]</span></pre>
53 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
54 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
55
56
57 and retrieves the document from one of the servers in the reply. The
58 example zone file near the end of the memo contains answering RRs for
59 this query.
60
61 The format of the SRV RR
62
63 Here is the format of the SRV RR, whose DNS type code is 33:
64
65 Service.Proto.Name TTL Class SRV Priority Weight Port Target
66
67 (There is an example near the end of this document.)
68
69 Service
70 The symbolic name of the desired service, as defined in Assigned
71 Numbers or locally.
72
73 Some widely used services, notably POP, don't have a single
74 universal name. If Assigned Numbers names the service
75 indicated, that name is the only name which is legal for SRV
76 lookups. Only locally defined services may be named locally.
77 The Service is case insensitive.
78
79 Proto
80 TCP and UDP are at present the most useful values
81 for this field, though any name defined by Assigned Numbers or
82 locally may be used (as for Service). The Proto is case
83 insensitive.
84
85 Name
86 The domain this RR refers to. The SRV RR is unique in that the
87 name one searches for is not this name; the example near the end
88 shows this clearly.
89
90 TTL
91 Standard DNS meaning.
92
93 Class
94 Standard DNS meaning.
95
96 Priority
97 As for MX, the priority of this target host. A client MUST
98 attempt to contact the target host with the lowest-numbered
99 priority it can reach; target hosts with the same priority
100 SHOULD be tried in pseudorandom order. The range is 0-65535.
101
102
103
104
105
106
107
108 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 2]</span></pre>
109 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
110 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
111
112
113 Weight
114 Load balancing mechanism. When selecting a target host among
115 the those that have the same priority, the chance of trying this
116 one first SHOULD be proportional to its weight. The range of
117 this number is 1-65535. Domain administrators are urged to use
118 Weight 0 when there isn't any load balancing to do, to make the
119 RR easier to read for humans (less noisy).
120
121 Port
122 The port on this target host of this service. The range is
123 0-65535. This is often as specified in Assigned Numbers but
124 need not be.
125
126 Target
127 As for MX, the domain name of the target host. There MUST be
128 one or more A records for this name. Implementors are urged, but
129 not required, to return the A record(s) in the Additional Data
130 section. Name compression is to be used for this field.
131
132 A Target of "." means that the service is decidedly not
133 available at this domain.
134
135 Domain administrator advice
136
137 Asking everyone to update their telnet (for example) clients when the
138 first internet site adds a SRV RR for Telnet/TCP is futile (even if
139 desirable). Therefore SRV will have to coexist with A record lookups
140 for a long time, and DNS administrators should try to provide A
141 records to support old clients:
142
143 - Where the services for a single domain are spread over several
144 hosts, it seems advisable to have a list of A RRs at the same
145 DNS node as the SRV RR, listing reasonable (if perhaps
146 suboptimal) fallback hosts for Telnet, NNTP and other protocols
147 likely to be used with this name. Note that some programs only
148 try the first address they get back from e.g. gethostbyname(),
149 and we don't know how widespread this behaviour is.
150
151 - Where one service is provided by several hosts, one can either
152 provide A records for all the hosts (in which case the round-
153 robin mechanism, where available, will share the load equally)
154 or just for one (presumably the fastest).
155
156 - If a host is intended to provide a service only when the main
157 server(s) is/are down, it probably shouldn't be listed in A
158 records.
159
160
161
162
163
164 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 3]</span></pre>
165 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
166 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
167
168
169 - Hosts that are referenced by backup A records must use the port
170 number specified in Assigned Numbers for the service.
171
172 Currently there's a practical limit of 512 bytes for DNS replies.
173 Until all resolvers can handle larger responses, domain
174 administrators are strongly advised to keep their SRV replies below
175 512 bytes.
176
177 All round numbers, wrote Dr. Johnson, are false, and these numbers
178 are very round: A reply packet has a 30-byte overhead plus the name
179 of the service ("telnet.tcp.asdf.com" for instance); each SRV RR adds
180 20 bytes plus the name of the target host; each NS RR in the NS
181 section is 15 bytes plus the name of the name server host; and
182 finally each A RR in the additional data section is 20 bytes or so,
183 and there are A's for each SRV and NS RR mentioned in the answer.
184 This size estimate is extremely crude, but shouldn't underestimate
185 the actual answer size by much. If an answer may be close to the
186 limit, using e.g. "dig" to look at the actual answer is a good idea.
187
188 The "Weight" field
189
190 Weight, the load balancing field, is not quite satisfactory, but the
191 actual load on typical servers changes much too quickly to be kept
192 around in DNS caches. It seems to the authors that offering
193 administrators a way to say "this machine is three times as fast as
194 that one" is the best that can practically be done.
195
196 The only way the authors can see of getting a "better" load figure is
197 asking a separate server when the client selects a server and
198 contacts it. For short-lived services like SMTP an extra step in the
199 connection establishment seems too expensive, and for long-lived
200 services like telnet, the load figure may well be thrown off a minute
201 after the connection is established when someone else starts or
202 finishes a heavy job.
203
204 The Port number
205
206 Currently, the translation from service name to port number happens
207 at the client, often using a file such as /etc/services.
208
209 Moving this information to the DNS makes it less necessary to update
210 these files on every single computer of the net every time a new
211 service is added, and makes it possible to move standard services out
212 of the "root-only" port range on unix.
213
214
215
216
217
218
219
220 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 4]</span></pre>
221 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
222 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
223
224
225 Usage rules
226
227 A SRV-cognizant client SHOULD use this procedure to locate a list of
228 servers and connect to the preferred one:
229
230 Do a lookup for QNAME=service.protocol.target, QCLASS=IN,
231 QTYPE=SRV.
232
233 If the reply is NOERROR, ANCOUNT&gt;0 and there is at least one SRV
234 RR which specifies the requested Service and Protocol in the
235 reply:
236
237 If there is precisely one SRV RR, and its Target is "."
238 (the root domain), abort.
239
240 Else, for all such RR's, build a list of (Priority, Weight,
241 Target) tuples
242
243 Sort the list by priority (lowest number first)
244
245 Create a new empty list
246
247 For each distinct priority level
248 While there are still elements left at this priority
249 level
250 Select an element randomly, with probability
251 Weight, and move it to the tail of the new list
252
253 For each element in the new list
254
255 query the DNS for A RR's for the Target or use any
256 RR's found in the Additional Data secion of the
257 earlier SRV query.
258
259 for each A RR found, try to connect to the (protocol,
260 address, service).
261
262 else if the service desired is SMTP
263
264 skip to <a href="./rfc974">RFC 974</a> (MX).
265
266 else
267
268 Do a lookup for QNAME=target, QCLASS=IN, QTYPE=A
269
270 for each A RR found, try to connect to the (protocol,
271 address, service)
272
273
274
275
276 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 5]</span></pre>
277 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
278 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
279
280
281 Notes:
282
283 - Port numbers SHOULD NOT be used in place of the symbolic service
284 or protocol names (for the same reason why variant names cannot
285 be allowed: Applications would have to do two or more lookups).
286
287 - If a truncated response comes back from an SRV query, and the
288 Additional Data section has at least one complete RR in it, the
289 answer MUST be considered complete and the client resolver
290 SHOULD NOT retry the query using TCP, but use normal UDP queries
291 for A RR's missing from the Additional Data section.
292
293 - A client MAY use means other than Weight to choose among target
294 hosts with equal Priority.
295
296 - A client MUST parse all of the RR's in the reply.
297
298 - If the Additional Data section doesn't contain A RR's for all
299 the SRV RR's and the client may want to connect to the target
300 host(s) involved, the client MUST look up the A RR(s). (This
301 happens quite often when the A RR has shorter TTL than the SRV
302 or NS RR's.)
303
304 - A future standard could specify that a SRV RR whose Protocol was
305 TCP and whose Service was SMTP would override <a href="./rfc974">RFC 974</a>'s rules
306 with regard to the use of an MX RR. This would allow firewalled
307 organizations with several SMTP relays to control the load
308 distribution using the Weight field.
309
310 - Future protocols could be designed to use SRV RR lookups as the
311 means by which clients locate their servers.
312
313 Fictional example
314
315 This is (part of) the zone file for asdf.com, a still-unused domain:
316
317 $ORIGIN asdf.com.
318 @ SOA server.asdf.com. root.asdf.com. (
319 1995032001 3600 3600 604800 86400 )
320 NS server.asdf.com.
321 NS ns1.ip-provider.net.
322 NS ns2.ip-provider.net.
323 ftp.tcp SRV 0 0 21 server.asdf.com.
324 finger.tcp SRV 0 0 79 server.asdf.com.
325 ; telnet - use old-slow-box or new-fast-box if either is
326 ; available, make three quarters of the logins go to
327 ; new-fast-box.
328 telnet.tcp SRV 0 1 23 old-slow-box.asdf.com.
329
330
331
332 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 6]</span></pre>
333 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
334 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
335
336
337 SRV 0 3 23 new-fast-box.asdf.com.
338 ; if neither old-slow-box or new-fast-box is up, switch to
339 ; using the sysdmin's box and the server
340 SRV 1 0 23 sysadmins-box.asdf.com.
341 SRV 1 0 23 server.asdf.com.
342 ; HTTP - server is the main server, new-fast-box is the backup
343 ; (On new-fast-box, the HTTP daemon runs on port 8000)
344 http.tcp SRV 0 0 80 server.asdf.com.
345 SRV 10 0 8000 new-fast-box.asdf.com.
346 ; since we want to support both <a href="http://asdf.com/">http://asdf.com/</a> and
347 ; <a href="http://www.asdf.com/">http://www.asdf.com/</a> we need the next two RRs as well
348 http.tcp.www SRV 0 0 80 server.asdf.com.
349 SRV 10 0 8000 new-fast-box.asdf.com.
350 ; SMTP - mail goes to the server, and to the IP provider if
351 ; the net is down
352 smtp.tcp SRV 0 0 25 server.asdf.com.
353 SRV 1 0 25 mailhost.ip-provider.net.
354 @ MX 0 server.asdf.com.
355 MX 1 mailhost.ip-provider.net.
356 ; NNTP - use the IP providers's NNTP server
357 nntp.tcp SRV 0 0 119 nntphost.ip-provider.net.
358 ; IDB is an locally defined protocol
359 idb.tcp SRV 0 0 2025 new-fast-box.asdf.com.
360 ; addresses
361 server A 172.30.79.10
362 old-slow-box A 172.30.79.11
363 sysadmins-box A 172.30.79.12
364 new-fast-box A 172.30.79.13
365 ; backup A records - new-fast-box and old-slow-box are
366 ; included, naturally, and server is too, but might go
367 ; if the load got too bad
368 @ A 172.30.79.10
369 A 172.30.79.11
370 A 172.30.79.13
371 ; backup A RR for www.asdf.com
372 www A 172.30.79.10
373 ; NO other services are supported
374 *.tcp SRV 0 0 0 .
375 *.udp SRV 0 0 0 .
376
377 In this example, a telnet connection to "asdf.com." needs an SRV
378 lookup of "telnet.tcp.asdf.com." and possibly A lookups of "new-
379 fast-box.asdf.com." and/or the other hosts named. The size of the
380 SRV reply is approximately 365 bytes:
381
382 30 bytes general overhead
383 20 bytes for the query string, "telnet.tcp.asdf.com."
384 130 bytes for 4 SRV RR's, 20 bytes each plus the lengths of "new-
385
386
387
388 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 7]</span></pre>
389 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
390 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
391
392
393 fast-box", "old-slow-box", "server" and "sysadmins-box" -
394 "asdf.com" in the query section is quoted here and doesn't
395 need to be counted again.
396 75 bytes for 3 NS RRs, 15 bytes each plus the lengths of
397 "server", "ns1.ip-provider.net." and "ns2" - again, "ip-
398 provider.net." is quoted and only needs to be counted once.
399 120 bytes for the 6 A RR's mentioned by the SRV and NS RR's.
400
401 Refererences
402
403 <a href="./rfc1918">RFC 1918</a>: Rekhter, Y., Moskowitz, R., Karrenberg, D., de Groot, G.,
404 and E. Lear, "Address Allocation for Private Internets",
405 <a href="./rfc1918">RFC 1918</a>, February 1996.
406
407 <a href="./rfc1916">RFC 1916</a> Berkowitz, H., Ferguson, P, Leland, W. and P. Nesser,
408 "Enterprise Renumbering: Experience and Information
409 Solicitation", <a href="./rfc1916">RFC 1916</a>, February 1996.
410
411 <a href="./rfc1912">RFC 1912</a> Barr, D., "Common DNS Operational and Configuration
412 Errors", <a href="./rfc1912">RFC 1912</a>, February 1996.
413
414 <a href="./rfc1900">RFC 1900</a>: Carpenter, B., and Y. Rekhter, "Renumbering Needs Work",
415 <a href="./rfc1900">RFC 1900</a>, February 1996.
416
417 <a href="./rfc1920">RFC 1920</a>: Postel, J., "INTERNET OFFICIAL PROTOCOL STANDARDS",
418 STD 1, <a href="./rfc1920">RFC 1920</a>, March 1996.
419
420 <a href="./rfc1814">RFC 1814</a>: Gerich, E., "Unique Addresses are Good", <a href="./rfc1814">RFC 1814</a>, June
421 1995.
422
423 <a href="./rfc1794">RFC 1794</a>: Brisco, T., "DNS Support for Load Balancing", April 1995.
424
425 <a href="./rfc1713">RFC 1713</a>: Romao, A., "Tools for DNS debugging", November 1994.
426
427 <a href="./rfc1712">RFC 1712</a>: Farrell, C., Schulze, M., Pleitner, S., and D. Baldoni,
428 "DNS Encoding of Geographical Location", <a href="./rfc1712">RFC 1712</a>, November
429 1994.
430
431 <a href="./rfc1706">RFC 1706</a>: Manning, B. and R. Colella, "DNS NSAP Resource Records",
432 <a href="./rfc1706">RFC 1706</a>, October 1994.
433
434 <a href="./rfc1700">RFC 1700</a>: Reynolds, J., and J. Postel, "ASSIGNED NUMBERS",
435 STD 2, <a href="./rfc1700">RFC 1700</a>, October 1994.
436
437 <a href="./rfc1183">RFC 1183</a>: Ullmann, R., Mockapetris, P., Mamakos, L., and
438 C. Everhart, "New DNS RR Definitions", <a href="./rfc1183">RFC 1183</a>, November
439 1990.
440
441
442
443
444 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 8]</span></pre>
445 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
446 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
447
448
449 <a href="./rfc1101">RFC 1101</a>: Mockapetris, P., "DNS encoding of network names and other
450 types", <a href="./rfc1101">RFC 1101</a>, April 1989.
451
452 <a href="./rfc1035">RFC 1035</a>: Mockapetris, P., "Domain names - implementation and
453 specification", STD 13, <a href="./rfc1035">RFC 1035</a>, November 1987.
454
455 <a href="./rfc1034">RFC 1034</a>: Mockapetris, P., "Domain names - concepts and
456 facilities", STD 13, <a href="./rfc1034">RFC 1034</a>, November 1987.
457
458 <a href="./rfc1033">RFC 1033</a>: Lottor, M., "Domain administrators operations guide",
459 <a href="./rfc1033">RFC 1033</a>, November 1987.
460
461 <a href="./rfc1032">RFC 1032</a>: Stahl, M., "Domain administrators guide", <a href="./rfc1032">RFC 1032</a>,
462 November 1987.
463
464 <a href="./rfc974">RFC 974</a>: Partridge, C., "Mail routing and the domain system",
465 STD 14, <a href="./rfc974">RFC 974</a>, January 1986.
466
467 Security Considerations
468
469 The authors believes this RR to not cause any new security problems.
470 Some problems become more visible, though.
471
472 - The ability to specify ports on a fine-grained basis obviously
473 changes how a router can filter packets. It becomes impossible
474 to block internal clients from accessing specific external
475 services, slightly harder to block internal users from running
476 unautorised services, and more important for the router
477 operations and DNS operations personnel to cooperate.
478
479 - There is no way a site can keep its hosts from being referenced
480 as servers (as, indeed, some sites become unwilling secondary
481 MXes today). This could lead to denial of service.
482
483 - With SRV, DNS spoofers can supply false port numbers, as well as
484 host names and addresses. The authors do not see any practical
485 effect of this.
486
487 We assume that as the DNS-security people invent new features, DNS
488 servers will return the relevant RRs in the Additional Data section
489 when answering an SRV query.
490
491
492
493
494
495
496
497
498
499
500 <span class="grey">Gulbrandsen &amp; Vixie Experimental [Page 9]</span></pre>
501 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
502 <span class="grey"><a href="./rfc2052">RFC 2052</a> DNS SRV RR October 1996</span>
503
504
505 Authors' Addresses
506
507 Arnt Gulbrandsen
508 Troll Tech
509 Postboks 6133 Etterstad
510 N-0602 Oslo
511 Norway
512
513 Phone: +47 22646966
514 EMail: [email protected]
515
516
517 Paul Vixie
518 Vixie Enterprises
519 Star Route 159A
520 Woodside, CA 94062
521
522 Phone: (415) 747-0204
523 EMail: [email protected]
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556 Gulbrandsen &amp; Vixie Experimental [Page 10]
557 </pre>