Network Working Group                                   Arnt Gulbrandsen
INTERNET-DRAFT                                        Troll Technologies
Updates: RFC1035, RFC1183                                     Paul Vixie
                                                       Vixie Enterprises
                                                              March 1995

            A DNS RR for specifying the location of services


   This document describes a DNS RR which specifies the location of the
   server(s) for a specific protocol and domain (like a more general
   form of MX).

Status of this memo

   This document is an Internet-Draft.  Internet-Drafts are working
   documents of the Internet Engineering Task Force (IETF), its areas,
   and its working groups.  Note that other groups may also distribute
   working documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as ``work in progress.''

   To learn the current status of any Internet-Draft, please check the
   ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
   Directories on (US East Coast),
   (Europe), (US West Coast), or (Pacific

   This draft has file name "draft-gulbrandsen-dns-rr-srvcs-00.txt" and
   expires on September 6, 1995.

Overview and rationale

   Currently, one must either know the exact address of a server to
   contact it, or broadcast a question.  This has led to e.g. aliases, the SMTP-specific MX RR, and using MAC-
   level broadcasts to locate servers.

   The SRV RR allows a client to ask for a specific service/protocol for
   a specific domain (the word domain is used here in the strict RFC1034
   sense), and get back the names of any available servers.  This allows
   domain adminstrators to use several servers for a single domain, to
   move servers with little fuss, and to designate some servers as
   primary and others as backups.

Gulbrandsen and Vixie                                           [Page 1]

Expires September 1995   DNS Service Pointer RR               March 1995

The format of the SRV RR

   Here is the format of the SRV RR: [ttl] class SRV priority capacity target

        (There is an example near the end of the draft.)

        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 which is legal for SRV
        lookups.  Only locally defined services may be named locally.

        The Service is case insensitive (it has to be, it's part of the
        DNS look-up key).

        The symbolic name of the desired protocol.  TCP and UDP are at
        present the most useful values for this field, though any name
        defined by Assigned Numbers or locally may be used (as for
        Service).  Case insensitive.

        The domain this RR refers to.  The SRV RR is unique in that the
        name one searches for is not this name; the example near the end
        shows this very clearly.

        Standard DNS meaning

        Standard DNS meaning

        As for MX, 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.
        Domain adminstrators are urged to use Priority 0 for the primary
        server(s), to make the RR easier to read for humans using dig or
        similar tools.

        Load balancing mechanism.  When selecting a target host among

Gulbrandsen and Vixie                                           [Page 2]

Expires September 1995   DNS Service Pointer RR               March 1995

        the those that have the same priority, the chance of trying this
        one first SHOULD be proportional to its weight.  The range of
        this number is 0-65535.  Domain adminstrators are urged to use
        Weight 0 when there isn't any load balancing to do, to make the
        RR easier to read for humans (less noisy).

        As for MX, the domain name of the server 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.

   Port numbers SHOULD NOT be used in place of the symbolic service or
   protocol names (for the same reason why variant names cannot be
   allowed: Applications would have to do two or more lookups).

Domain adminstrator advice

   Asking everyone to update their telnet (for example) clients when the
   first internet site adds a SRV RR for SMTP/TCP is futile (even if
   desirable).  Therefore SRV will have to coexist with old-style A
   record lookups for a long time, and DNS administrators 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, listing reasonable (if perhaps
        suboptimal) fallback hosts for telnet, nntp and other protocols
        likely to be used with this name.  Some programs only try the
        first address they get back from e.g. gethostbyaddr(), and we
        don't know how widespread this behaviour is.

      - Where one service is provided by several hosts, one 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

   Currently there's a practical limit of 512 bytes for DNS replies.
   Until all resolvers can handle larger responses, domain adminstrators
   are strongly advised to keep their SRV replies below 512 bytes.

   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 ("" for instance); each SRV RR adds

Gulbrandsen and Vixie                                           [Page 3]

Expires September 1995   DNS Service Pointer RR               March 1995

   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 shouldn't underestimate
   the actual answer size by much.  If an answer may be close to the
   limit, using "dig" or some similar program to look at the actual
   answer is a good idea.

The "Weight" field

   Weight, the load balancing field, is not quite satisfactory, but the
   actual load on typical servers changes much too quickly to be kept
   around in DNS caches.  It seems to the authors that offering
   administrators a way to say "this machine is three times as fast as
   that one" is the best that can easily 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 the
   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.

Usage rules

   A SRV-cognizant client SHOULD use this procedure to locate a list of
   servers and connect to the preferred one:

        Do a lookup for, QCLASS=IN,

        If the reply is NOERROR, ANCOUNT>0 and there is at least one SRV
        RR which specifies the Service and Protocol in the reply:

             for all such RR's, build a list of (Priority, Weight,
             Target) tuples

             Sort the list by priority (lowest first)

             Create a new empty list

             For each distinct priority level
                  While there are still elements left at this priority
                       Select an element randomly, with probability
                       Weight, and move it to the tail of the new list

Gulbrandsen and Vixie                                           [Page 4]

Expires September 1995   DNS Service Pointer RR               March 1995

             For each element in the new list

                  query the DNS for A RR's for the Target or use any
                  RR's found in the Additional Data secion of the
                  earlier SRV query.

                  for each A RR found, try to connect to the (protocol,
                  address, service).

        else if the service desired is SMTP

             skip to RFC974 (MX).


             Do a lookup for QNAME=target, QCLASS=IN, QTYPE=A

             for each A RR found, try to connect to the (protocol,
             address, service)


      - If a truncated response comes back from an SRV query, and the
        Additional Data section has at least one complete RR in it, the
        answer MUST be considered complete and the client resolver
        SHOULD NOT retry the query using TCP, but use normal UDP queries
        for A RR's missing from the Additional Data section.

      - A client MAY NOT discard any of the answers returned.  RFC974
        allows clients to e.g. try to connect to just the 5 first MXes
        returned:  Such behaviour is NOT legal with SRV lookups.

      - If the Additional Data section doesn't contain A RR's for all
        the SRV RR's, the client MUST look up the A RR(s).  (This
        happens quite often when the A RR has shorter TTL than the SRV
        or NS RR's.)

      - SRV RRs with Protocol TCP and Service SMTP override MX RR's.
        This allows firewalled organizations with several SMTP relays to
        control the load distribution using the Weight field.

      - Designers of new protocols are urged to specify that SRV lookups
        be mandatory for those protocols.

Fictional example

        This is (part of) the zone file for, a still-unused

Gulbrandsen and Vixie                                           [Page 5]

Expires September 1995   DNS Service Pointer RR               March 1995

             @               SOA (
                                     1995032001 3600 3600 604800 86400 )
                             NS      server
             ftp.tcp         SRV     0 0
             finger.tcp      SRV     0 0
             ; 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
                             SRV     0 3
             ; if neither old-slow-box or new-fast-box is up, switch to
             using the
             ; sysdmin's box and the server
                             SRV     1 0
                             SRV     1 0
             ; SMTP - mail goes to the server, and to the IP provider if
             ; the net is down
             smtp.tcp        SRV     0 0
                             SRV     1 0
                             MX      0
                             MX      1
             ; NNTP - use the IP providers's NNTP server
             nntp.tcp        SRV     0 0
             ; for all other services, use the general-purpose server
             *.tcp           SRV     0 0
             *.udp           SRV     0 0
             ; addresses
             server          A
             old-slow-box    A
             sysadmins-box   A
             new-fast-box    A
             ; 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

        In this example, a telnet connection to "" needs an SRV
        lookup of "" and possibly A lookups of
        "" and/or the other hosts named.  The size
        of the answer for this lookup for "" is
        approximately 385 bytes:

           30 bytes general overhead

Gulbrandsen and Vixie                                           [Page 6]

Expires September 1995   DNS Service Pointer RR               March 1995

           20 bytes for the query string, ""
           130 bytes for 4 SRV RR's, 20 bytes each plus the lengths of
             "new-fast-box", "old-slow-box", "server" and "sysadmins-
             box" - "" 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", "" and "ns2" - again, "ip-
   " gets quoted and only needs to be counted
           140 bytes for the 7 A RR's mentioned by the SRV and NS RR's.


        RFC 1700: J. Reynolds, J. Postel, "ASSIGNED NUMBERS",

        RFC 1536: A. Kumar, J. Postel, C. Neuman, P. Danzig, S. Miller,
             "Common DNS Implementation Errors and Suggested Fixes.",

        RFC 1348: B. Manning, "DNS NSAP RRs", 07/01/1992.

        RFC 1183: R. Ullman, P. Mockapetris, L. Mamakos, C. Everhart,
             "New DNS RR Definitions", 10/08/1990.

        RFC 1101: P. Mockapetris, "DNS encoding of network names and
             other types", 04/01/1989.

        RFC 1035: P. Mockapetris, "Domain names - implementation and
             specification", 11/01/1987.

        RFC 1034: P. Mockapetris, "Domain names - concepts and
             facilities", 11/01/1987.

        RFC 1033: M. Lottor, "Domain administrators operations guide",

        RFC 1032: M. Stahl, "Domain administrators guide", 11/01/1987.

        RFC 974: C. Partridge, "Mail routing and the domain system",

Security Considerations

        The authors believes this RR to be perfectly safe - or rather,
        not to cause any new security problems.  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

Gulbrandsen and Vixie                                           [Page 7]

Expires September 1995   DNS Service Pointer RR               March 1995

        an SRV query.

Authors' Addresses

        Arnt Gulbrandsen
        Troll Technologies
        0600 Oslo

        Phone: +47 22646966


        Paul Vixie
        Vixie Enterprises
        Star Route 159A
        Woodside, CA  94062

        Phone: (415) 747-0204


Gulbrandsen and Vixie                                           [Page 8]