home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / share / wnt / nettime / sntp40.txt < prev    next >
Encoding:
Text File  |  1998-09-03  |  47.6 KB  |  962 lines

  1.   
  2. Network Working Group  
  3. Request for Comments: 2030  
  4. Obsoletes: 1769  
  5. Category: Informational 
  6.                                          D. Mills  
  7.                              University of Delaware  
  8.                                      October 1996 
  9.  
  10.  
  11.       Simple Network Time
  12.   Protocol (SNTP) Version 4
  13.      for IPv4, IPv6 and OSI
  14.  
  15. Status of this Memo
  16.  
  17.     This memo provides information for the Internet
  18.     community. This memo does not specify an Internet
  19.     standard of any kind. Distribution of this memo is
  20.     unlimited. 
  21.  
  22.     Abstract
  23.  
  24.     This memorandum describes the Simple Network Time
  25.     Protocol (SNTP) Version 4, which is an adaptation of
  26.     the Network Time Protocol (NTP) used to synchronize
  27.     computer clocks in the Internet. SNTP can be used
  28.     when the ultimate performance of the full NTP
  29.     implementation described in RFC-1305 is not needed
  30.     or justified. When operating with current and previous
  31.     NTP and SNTP versions, SNTP Version 4 involves no
  32.     changes to the NTP specification or known
  33.     implementations, but rather a clarification of certain
  34.     design features of NTP which allow operation in a
  35.     simple, stateless remote-procedure call (RPC) mode
  36.     with accuracy and reliability expectations similar to the
  37.     UDP/TIME protocol described in RFC-868. 
  38.  
  39.     The only significant protocol change in SNTP Version
  40.     4 over previous versions of NTP and SNTP is a
  41.     modified header interpretation to accommodate Internet
  42.     Protocol Version 6 (IPv6) [DEE96] and OSI [COL94]
  43.     addressing. However, SNTP Version 4 includes certain
  44.     optional extensions to the basic Version 3 model,
  45.     including an anycast mode and an authentication scheme
  46.     designed specifically for multicast and anycast modes.
  47.     While the anycast mode extension is described in this
  48.     document, the authentication scheme extension will be
  49.     described in another document to be published later.
  50.     Until such time that a definitive specification is
  51.     published, these extensions should be considered
  52.     provisional. 
  53.  
  54.     This memorandum obsoletes RFC-1769, which
  55.     describes SNTP Version 3. Its purpose is to correct
  56.     certain inconsistencies in the previous document and to
  57.     clarify header formats and protocol operations for
  58.     current NTP Version 3 (IPv4) and proposed NTP
  59.     Version 4 (IPv6 and OSI), which are also used for
  60.     SNTP. A working knowledge of the NTP Version 3
  61.     specification RFC-1305 is not required for an
  62.     implementation of SNTP. 
  63.  
  64.     1. Introduction
  65.  
  66.     The Network Time Protocol (NTP) Version 3 specified
  67.     in RFC-1305 [MIL92] is widely used to synchronize
  68.     computer clocks in the global Internet. It provides
  69.     comprehensive mechanisms to access national time and
  70.     frequency dissemination services, organize the time-
  71.     synchronization subnet and adjust the local clock in
  72.     each participating subnet peer. In most places of the
  73.     Internet of today, NTP provides accuracies of 1-50 ms,
  74.     depending on the characteristics of the synchronization
  75.     source and network paths. 
  76.  
  77.     RFC-1305 specifies the NTP Version 3 protocol
  78.     machine in terms of events, states, transition functions
  79.     and actions and, in addition, engineered algorithms to
  80.     improve the timekeeping quality and mitigate among
  81.     several synchronization sources, some of which may be
  82.     faulty. To achieve accuracies in the low milliseconds
  83.     over paths spanning major portions of the Internet of
  84.     today, these intricate algorithms, or their functional
  85.     equivalents, are necessary. However, in many cases
  86.     accuracies in the order of significant fractions of a
  87.     second are acceptable. In such cases, simpler protocols
  88.     such as the Time Protocol [POS83], have been used for
  89.     this purpose. These protocols usually involve an RPC
  90.     exchange where the client requests the time of day and
  91.     the server returns it in seconds past some known
  92.     reference epoch. 
  93.  
  94.     NTP is designed for use by clients and servers with a
  95.     wide range of capabilities and over a wide range of
  96.     network delays and jitter characteristics. Most users of
  97.     the Internet NTP synchronization subnet of today use a
  98.     software package including the full suite of NTP
  99.     options and algorithms, which are relatively complex,
  100.     real-time applications (see
  101.     http://www.eecis.udel.edu/~ntp). While the software
  102.     has been ported to a wide variety of hardware
  103.     platforms ranging from personal computers to
  104.     supercomputers, its sheer size and complexity is not
  105.     appropriate for many applications. Accordingly, it is
  106.     useful to explore alternative access strategies using
  107.     simpler software appropriate for less stringent
  108.     accuracy expectations. 
  109.  
  110.     This document describes the Simple Network Time
  111.     Protocol (SNTP) Version 4, which is a simplified
  112.     access strategy for servers and clients using NTP
  113.     Version 3 as now specified and deployed in the
  114.     Internet, as well as NTP Version 4 now under
  115.     development. The access paradigm is identical to the
  116.     UDP/TIME Protocol and, in fact, it should be easily
  117.     possible to adapt a UDP/TIME client implementation,
  118.     say for a personal computer, to operate using SNTP.
  119.     Moreover, SNTP is also designed to operate in a
  120.     dedicated server configuration including an integrated
  121.     radio clock. With careful design and control of the
  122.     various latencies in the system, which is practical in a
  123.     dedicated design, it is possible to deliver time accurate
  124.     to the order of microseconds. 
  125.  
  126.     SNTP Version 4 is designed to coexist with existing
  127.     NTP and SNTP Version 3 clients and servers, as well
  128.     as proposed Version 4 clients and servers. When
  129.     operating with current and previous versions of NTP
  130.     and SNTP, SNTP Version 4 requires no changes to the
  131.     protocol or implementations now running or likely to
  132.     be implemented specifically for NTP ir SNTP Version
  133.     4. To a NTP or SNTP server, NTP and SNTP clients
  134.     are undistinguishable; to a NTP or SNTP client, NTP
  135.     and SNTP servers are undistinguishable. Like NTP
  136.     servers operating in non- symmetric modes, SNTP
  137.     servers are stateless and can support large numbers of
  138.     clients; however, unlike most NTP clients, SNTP
  139.     clients normally operate with only a single server. NTP
  140.     and SNTP Version 3 servers can operate in unicast and
  141.     multicast modes. In addition, SNTP Version 4 clients
  142.     and servers can implement extensions to operate in
  143.     anycast mode. 
  144.  
  145.     It is strongly recommended that SNTP be used only at
  146.     the extremities of the synchronization subnet. SNTP
  147.     clients should operate only at the leaves (highest
  148.     stratum) of the subnet and in configurations where no
  149.     NTP or SNTP client is dependent on another SNTP
  150.     client for synchronization. SNTP servers should
  151.     operate only at the root (stratum 1) of the subnet and
  152.     then only in configurations where no other source of
  153.     synchronization other than a reliable radio or modem
  154.     time service is available. The full degree of reliability
  155.     ordinarily expected of primary servers is possible only
  156.     using the redundant sources, diverse subnet paths and
  157.     crafted algorithms of a full NTP implementation. This
  158.     extends to the primary source of synchronization itself
  159.     in the form of multiple radio or modem sources and
  160.     backup paths to other primary servers should all
  161.     sources fail or the majority deliver incorrect time.
  162.     Therefore, the use of SNTP rather than NTP in primary
  163.     servers should be carefully considered. 
  164.  
  165.     An important provision in this document is the
  166.     reinterpretation of certain NTP Versino 4 header fields
  167.     which provide for IPv6 and OSI addressing and
  168.     optional anycast extensions designed specifically for
  169.     multicast service. These additions are in conjunction
  170.     with the proposed NTP Version 4 specification, which
  171.     will appear as a separate document. The only
  172.     difference between the current NTP Version 3 and
  173.     proposed NTP Version 4 header formats is the
  174.     interpretation of the four-octet Reference Identifier
  175.     field, which is used primarily to detect and avoid
  176.     synchronization loops. In Version 3 and Version 4
  177.     primary (stratum-1) servers, this field contains the
  178.     four-character ASCII reference identifier defined later
  179.     in this document. In Version 3 secondary servers and
  180.     clients, it contains the 32-bit IPv4 address of the
  181.     synchronization source. In Version 4 secondary servers
  182.     and clients, it contains the low order 32 bits of the last
  183.     transmit timestamp received from the synchronization
  184.     source. In the case of OSI, the Connectionless
  185.     Transport Service (CLTS) is used [ISO86]. Each
  186.     SNTP packet is transmitted as tht TS-Userdata
  187.     parameter of a T-UNITDATA Request primitive.
  188.     Alternately, the header can be encapsulated in a TPDU
  189.     which itself is transported using UDP [DOB91]. It is
  190.     not advised that NTP be operated at the upper layers of
  191.     the OSI stack, such as might be inferred from [FUR94],
  192.     as this could seriously degrade accuracy. With the
  193.     header formats defined in this document, it is in
  194.     principle possible to interwork between servers and
  195.     clients of one protocol family and another, although the
  196.     practical difficulties may make this inadvisable. 
  197.  
  198.           In the following, indented paragraphs such as this one contain
  199.           information not required by the formal protocol specification, but
  200.           considered good practice in protocol implementations.
  201.  
  202.     2. Operating Modes and
  203.     Addressing
  204.  
  205.     SNTP Version 4 can operate in either unicast (point to
  206.     point), multicast (point to multipoint) or anycast
  207.     (multipoint to point) modes. A unicast client sends a
  208.     request to a designated server at its unicast address and
  209.     expects a reply from which it can determine the time
  210.     and, optionally, the roundtrip delay and local clock
  211.     offset relative to the server. A multicast server
  212.     periodically sends a unsolicited message to a
  213.     designated IPv4 or IPv6 local broadcast address or
  214.     multicast group address and ordinarily expects no
  215.     requests from clients. A multicast client listens on this
  216.     address and ordinarily sends no requests. An anycast
  217.     client sends a request to a designated IPv4 or IPv6
  218.     local broadcast address or multicast group address.
  219.     One or more anycast servers reply with their individual
  220.     unicast addresses. The client binds to the first one
  221.     received, then continues operation in unicast mode. 
  222.  
  223.           Multicast servers should respond to client unicast requests, as
  224.           well as send unsolicited multicast messages. Multicast clients may
  225.           send unicast requests in order to determine the network
  226.           propagation delay between the server and client and then continue
  227.           operation in multicast mode.
  228.  
  229.     In unicast mode, the client and server end-system
  230.     addresses are assigned following the usual IPv4, IPv6
  231.     or OSI conventions. In multicast mode, the server uses
  232.     a designated local broadcast address or multicast group
  233.     address. An IP local broadcast address has scope
  234.     limited to a single IP subnet, since routers do not
  235.     propagate IP broadcast datagrams. On the other hand,
  236.     an IP multicast group address has scope extending to
  237.     potentially the entire Internet. The scoping, routing and
  238.     group membership procedures are determined by
  239.     considerations beyond the scope of this document. For
  240.     IPv4, the IANA has assigned the multicast group
  241.     address 224.0.1.1 for NTP, which is used both by
  242.     multicast servers and anycast clients. NTP multicast
  243.     addresses for IPv6 and OSI have yet to be determined. 
  244.  
  245.     Multicast clients listen on the designated local
  246.     broadcast address or multicast group address. In the
  247.     case of local broadcast addresses, no further
  248.     provisions are necessary. In the case of IP multicast
  249.     addresses, the multicast client and anycast server must
  250.     implement the Internet Group Management Protocol
  251.     (IGMP) [DEE89], in order that the local router joins
  252.     the multicast group and relays messages to the IPv4 or
  253.     IPv6 multicast group addresses assigned by the IANA.
  254.     Other than the IP addressing conventions and IGMP,
  255.     there is no difference in server or client operations
  256.     with either the local broadcast address or multicast
  257.     group address. 
  258.  
  259.           It is important to adjust the time-to-live (TTL) field in the IP
  260.           header of multicast messages to a reasonable value, in order to
  261.           limit the network resources used by this (and any other) multicast
  262.           service. Only multicast clients in scope will receive multicast
  263.           server messages. Only cooperating anycast servers in scope will
  264.           reply to a client request. The engineering principles which
  265.           determine the proper value to be used are beyond the scope of this
  266.           document.
  267.  
  268.     Anycast mode is designed for use with a set of
  269.     cooperating servers whose addresses are not known
  270.     beforehand by the client. An anycast client sends a
  271.     request to the designated local broadcast or multicast
  272.     group address as described below. For this purpose,
  273.     the NTP multicast group address assigned by the IANA
  274.     is used. One or more anycast servers listen on the
  275.     designated local broadcast address or multicast group
  276.     address. Each anycast server, upon receiving a request,
  277.     sends a unicast reply message to the originating client.
  278.     The client then binds to the first such message received
  279.     and continues operation in unicast mode. Subsequent
  280.     replies from other anycast servers are ignored. 
  281.  
  282.           In the case of SNTP as specified herein, there is a very real
  283.           vulnerability that SNTP multicast clients can be disrupted by
  284.           misbehaving or hostile SNTP or NTP multicast servers elsewhere in
  285.           the Internet, since at present all such servers use the same IPv4
  286.           multicast group address assigned by the IANA. Where necessary,
  287.           access control based on the server source address can be used to
  288.           select only the designated server known to and trusted by the
  289.           client. The use of cryptographic authentication scheme defined in
  290.           RFC-1305 is optional; however, implementors should be advised that
  291.           extensions to this scheme are planned specifically for NTP
  292.           multicast and anycast modes.
  293.           While not integral to the SNTP specification, it is intended that
  294.           IP broadcast addresses will be used primarily in IP subnets and
  295.           LAN segments including a fully functional NTP server with a number
  296.           of dependent SNTP multicast clients on the same subnet, while IP
  297.           multicast group addresses will be used only in cases where the TTL
  298.           is engineered specifically for each service domain.
  299.           In NTP Version 3, the reference identifier was often used to
  300.           walk-back the synchronization subnet to the root (primary server)
  301.           for management purposes. In NTP Version 4, this feature is not
  302.           available, since the addresses are longer than 32 bits. However,
  303.           the intent in the protocol design was to provide a way to detect
  304.           and avoid loops. A peer could determine that a loop was possible
  305.           by comparing the contents of this field with the IPv4 destination
  306.           address in the same packet. A NTP Version 4 server can accomplish
  307.           the same thing by comparing the contents of this field with the
  308.           low order 32 bits of the originate timestamp in the same packet.
  309.           There is a small possibility of false alarm in this scheme, but
  310.           the false alarm rate can be minimized by randomizing the low order
  311.           unused bits of the transmit timestamp.
  312.  
  313.     3. NTP Timestamp Format
  314.  
  315.     SNTP uses the standard NTP timestamp format
  316.     described in RFC-1305 and previous versions of that
  317.     document. In conformance with standard Internet
  318.     practice, NTP data are specified as integer or
  319.     fixed-point quantities, with bits numbered in big-endian
  320.     fashion from 0 starting at the left, or high-order,
  321.     position. Unless specified otherwise, all quantities are
  322.     unsigned and may occupy the full field width with an
  323.     implied 0 preceding bit 0. 
  324.  
  325.     Since NTP timestamps are cherished data and, in fact,
  326.     represent the main product of the protocol, a special
  327.     timestamp format has been established. NTP
  328.     timestamps are represented as a 64-bit unsigned
  329.     fixed-point number, in seconds relative to 0h on 1
  330.     January 1900. The integer part is in the first 32 bits and
  331.     the fraction part in the last 32 bits. In the fraction part,
  332.     the non-significant low order can be set to 0. 
  333.  
  334.           It is advisable to fill the non-significant low order bits of the
  335.           timestamp with a random, unbiased bitstring, both to avoid
  336.           systematic roundoff errors and as a means of loop detection and
  337.           replay detection (see below). One way of doing this is to generate
  338.           a random bitstring in a 64-bit word, then perform an arithmetic
  339.           right shift a number of bits equal to the number of significant
  340.           bits of the timestamp, then add the result to the original
  341.           timestamp.
  342.  
  343.     This format allows convenient multiple-precision
  344.     arithmetic and conversion to UDP/TIME representation
  345.     (seconds), but does complicate the conversion to ICMP
  346.     Timestamp message representation, which is in
  347.     milliseconds. The maximum number that can be
  348.     represented is 4,294,967,295 seconds with a precision
  349.     of about 200 picoseconds, which should be adequate
  350.     for even the most exotic require 
  351.  
  352.     1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
  353.     9 0 1 2 3 4 5 6 7 8 9 0 1
  354.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  355.  
  356.     |                          
  357.     Seconds                                   | 
  358.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  359.  
  360.     |                  Seconds Fraction
  361.     (0-padded)                        | 
  362.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  363.  
  364.     Note that, since some time in 1968 (second
  365.     2,147,483,648) the most significant bit (bit 0 of the
  366.     integer part) has been set and that the 64-bit field will
  367.     overflow some time in 2036 (second 4,294,967,296).
  368.     Should NTP or SNTP be in use in 2036, some external
  369.     means will be necessary to qualify time relative to
  370.     1900 and time relative to 2036 (and other multiples of
  371.     136 years). There will exist a 200-picosecond interval,
  372.     henceforth ignored, every 136 years when the 64-bit
  373.     field will be 0, which by convention is interpreted as
  374.     an invalid or unavailable timestamp. 
  375.  
  376.           As the NTP timestamp format has been in use for the last 17 years,
  377.           it remains a possibility that it will be in use 40 years from now
  378.           when the seconds field overflows. As it is probably inappropriate
  379.           to archive NTP timestamps before bit 0 was set in 1968, a
  380.           convenient way to extend the useful life of NTP timestamps is the
  381.           following convention: If bit 0 is set, the UTC time is in the
  382.           range 1968-2036 and UTC time is reckoned from 0h 0m 0s UTC on 1
  383.           January 1900. If bit 0 is not set, the time is in the range 2036-
  384.           2104 and UTC time is reckoned from 6h 28m 16s UTC on 7 February
  385.           2036. Note that when calculating the correspondence, 2000 is not a
  386.           leap year. Note also that leap seconds are not counted in the
  387.           reckoning.
  388.  
  389.     4. NTP Message Format
  390.  
  391.     Both NTP and SNTP are clients of the User Datagram
  392.     Protocol (UDP) [POS80], which itself is a client of the
  393.     Internet Protocol (IP) [DAR81]. The structure of the IP
  394.     and UDP headers is described in the cited specification
  395.     documents and will not be detailed further here. The
  396.     UDP port number assigned to NTP is 123, which
  397.     should be used in both the Source Port and Destination
  398.     Port fields in the UDP header. The remaining UDP
  399.     header fields should be set as described in the
  400.     specification. Below is a description of the NTP/SNTP
  401.     Version 4 message format, which follows the IP and
  402.     UDP headers. This format is identical to that described
  403.     in RFC-1305, with the exception of the contents of the
  404.     reference identifier field. The header fields are defined
  405.     as follows: 
  406.  
  407.                                1                   2                   3
  408.            0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  409.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  410.           |LI | VN  |Mode |    Stratum    |     Poll      |   Precision   |
  411.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  412.           |                          Root Delay                           |
  413.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  414.           |                       Root Dispersion                         |
  415.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  416.           |                     Reference Identifier                      |
  417.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  418.           |                                                               |
  419.           |                   Reference Timestamp (64)                    |
  420.           |                                                               |
  421.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  422.           |                                                               |
  423.           |                   Originate Timestamp (64)                    |
  424.           |                                                               |
  425.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  426.           |                                                               |
  427.           |                    Receive Timestamp (64)                     |
  428.           |                                                               |
  429.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  430.           |                                                               |
  431.           |                    Transmit Timestamp (64)                    |
  432.           |                                                               |
  433.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  434.           |                 Key Identifier (optional) (32)                |
  435.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  436.           |                                                               |
  437.           |                                                               |
  438.           |                 Message Digest (optional) (128)               |
  439.           |                                                               |
  440.           |                                                               |
  441.           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  442.  
  443.     As described in the next section, in SNTP most of these
  444.     fields are initialized with pre-specified data. For
  445.     completeness, the function of each field is briefly
  446.     summarized below. Leap Indicator (LI): This is a
  447.     two-bit code warning of an impending leap second to
  448.     be inserted/deleted in the last minute of the current day,
  449.     with bit 0 and bit 1, respectively, coded as follows: 
  450.  
  451.           LI       Value     Meaning
  452.           -------------------------------------------------------
  453.           00       0         no warning
  454.           01       1         last minute has 61 seconds
  455.           10       2         last minute has 59 seconds)
  456.           11       3         alarm condition (clock not synchronized)
  457.  
  458.     Version Number (VN): This is a three-bit integer
  459.     indicating the NTP/SNTP version number. The version
  460.     number is 3 for Version 3 (IPv4 only) and 4 for Version
  461.     4 (IPv4, IPv6 and OSI). If necessary to distinguish
  462.     between IPv4, IPv6 and OSI, the encapsulating context
  463.     must be inspected. 
  464.  
  465.     Mode: This is a three-bit integer indicating the mode,
  466.     with values defined as follows: 
  467.  
  468.           Mode     Meaning
  469.           ------------------------------------
  470.           0        reserved
  471.           1        symmetric active
  472.           2        symmetric passive
  473.           3        client
  474.           4        server
  475.           5        broadcast
  476.           6        reserved for NTP control message
  477.           7        reserved for private use
  478.  
  479.     In unicast and anycast modes, the client sets this field to
  480.     3 (client) in the request and the server sets it to 4
  481.     (server) in the reply. In multicast mode, the server sets
  482.     this field to 5 (broadcast). 
  483.  
  484.     Stratum: This is a eight-bit unsigned integer indicating
  485.     the stratum level of the local clock, with values defined
  486.     as follows: 
  487.  
  488.           Stratum  Meaning
  489.           ----------------------------------------------
  490.           0        unspecified or unavailable
  491.           1        primary reference (e.g., radio clock)
  492.           2-15     secondary reference (via NTP or SNTP)
  493.           16-255   reserved
  494.  
  495.     Poll Interval: This is an eight-bit signed integer
  496.     indicating the maximum interval between successive
  497.     messages, in seconds to the nearest power of two. The
  498.     values that can appear in this field presently range from
  499.     4 (16 s) to 14 (16284 s); however, most applications
  500.     use only the sub-range 6 (64 s) to 10 (1024 s). 
  501.  
  502.     Precision: This is an eight-bit signed integer indicating
  503.     the precision of the local clock, in seconds to the
  504.     nearest power of two. The values that normally appear
  505.     in this field range from -6 for mains-frequency clocks
  506.     to -20 for microsecond clocks found in some
  507.     workstations. 
  508.  
  509.     Root Delay: This is a 32-bit signed fixed-point number
  510.     indicating the total roundtrip delay to the primary
  511.     reference source, in seconds with fraction point
  512.     between bits 15 and 16. Note that this variable can take
  513.     on both positive and negative values, depending on the
  514.     relative time and frequency offsets. The values that
  515.     normally appear in this field range from negative
  516.     values of a few milliseconds to positive values of
  517.     several hundred milliseconds. 
  518.  
  519.     Root Dispersion: This is a 32-bit unsigned fixed-point
  520.     number indicating the nominal error relative to the
  521.     primary reference source, in seconds with fraction
  522.     point between bits 15 and 16. The values that normally
  523.     appear in this field range from 0 to several hundred
  524.     milliseconds. 
  525.  
  526.     Reference Identifier: This is a 32-bit bitstring
  527.     identifying the particular reference source. In the case
  528.     of NTP Version 3 or Version 4 stratum-0 (unspecified)
  529.     or stratum-1 (primary) servers, this is a four-character
  530.     ASCII string, left justified and zero padded to 32 bits.
  531.     In NTP Version 3 secondary servers, this is the 32-bit
  532.     IPv4 address of the reference source. In NTP Version 4
  533.     secondary servers, this is the low order 32 bits of the
  534.     latest transmit timestamp of the reference source. NTP
  535.     primary (stratum 1) servers should set this field to a
  536.     code identifying the external reference source
  537.     according to the following list. If the external reference
  538.     is one of those listed, the associated code should be
  539.     used. Codes for sources not listed can be contrived as
  540.     appropriate. 
  541.  
  542.           Code     External Reference Source
  543.           ----------------------------------------------------------------
  544.           LOCL     uncalibrated local clock used as a primary reference for
  545.                    a subnet without external means of synchronization
  546.           PPS      atomic clock or other pulse-per-second source
  547.                    individually calibrated to national standards
  548.           ACTS     NIST dialup modem service
  549.           USNO     USNO modem service
  550.           PTB      PTB (Germany) modem service
  551.           TDF      Allouis (France) Radio 164 kHz
  552.           DCF      Mainflingen (Germany) Radio 77.5 kHz
  553.           MSF      Rugby (UK) Radio 60 kHz
  554.           WWV      Ft. Collins (US) Radio 2.5, 5, 10, 15, 20 MHz
  555.           WWVB     Boulder (US) Radio 60 kHz
  556.           WWVH     Kaui Hawaii (US) Radio 2.5, 5, 10, 15 MHz
  557.           CHU      Ottawa (Canada) Radio 3330, 7335, 14670 kHz
  558.           LORC     LORAN-C radionavigation system
  559.           OMEG     OMEGA radionavigation system
  560.           GPS      Global Positioning Service
  561.           GOES     Geostationary Orbit Environment Satellite
  562.  
  563.     Reference Timestamp: This is the time at which the
  564.     local clock was last set or corrected, in 64-bit
  565.     timestamp format. 
  566.  
  567.     Originate Timestamp: This is the time at which the
  568.     request departed the client for the server, in 64-bit
  569.     timestamp format. 
  570.  
  571.     Receive Timestamp: This is the time at which the
  572.     request arrived at the server, in 64-bit timestamp
  573.     format. 
  574.  
  575.     Transmit Timestamp: This is the time at which the reply
  576.     departed the server for the client, in 64-bit timestamp
  577.     format. 
  578.  
  579.     Authenticator (optional): When the NTP authentication
  580.     scheme is implemented, the Key Identifier and Message
  581.     Digest fields contain the message authentication code
  582.     (MAC) information defined in Appendix C of
  583.     RFC-1305. 
  584.  
  585.     5. SNTP Client Operations
  586.  
  587.     A SNTP client can operate in multicast mode, unicast
  588.     mode or anycast mode. In multicast mode, the client
  589.     sends no request and waits for a broadcast (mode 5)
  590.     from a designated multicast server. In unicast mode, the
  591.     client sends a request (mode 3) to a designated unicast
  592.     server and expects a reply (mode 4) from that server. In
  593.     anycast mode, the client sends a request (mode 3) to a
  594.     designated local broadcast or multicast group address
  595.     and expects a reply (mode 4) from one or more anycast
  596.     servers. The client uses the first reply received to
  597.     establish the particular server for subsequent unicast
  598.     operations. Later replies from this server (duplicates)
  599.     or any other server are ignored. Other than the selection
  600.     of address in the request, the operations of anycast and
  601.     unicast clients are identical. Requests are normally sent
  602.     at intervals from 64 s to 1024 s, depending on the
  603.     frequency tolerance of the client clock and the required
  604.     accuracy. 
  605.  
  606.     A unicast or anycast client initializes the NTP message
  607.     header, sends the request to the server and strips the
  608.     time of day from the Transmit Timestamp field of the
  609.     reply. For this purpose, all of the NTP header fields
  610.     shown above can be set to 0, except the first octet and
  611.     (optional) Transmit Timestamp fields. In the first octet,
  612.     the LI field is set to 0 (no warning) and the Mode field
  613.     is set to 3 (client). The VN field must agree with the
  614.     version number of the NTP/SNTP server; however,
  615.     Version 4 servers will also accept previous versions.
  616.     Version 3 (RFC-1305) and Version 2 (RFC-1119)
  617.     servers already accept all previous versions, including
  618.     Version 1 (RFC-1059). Note that Version 0 (RFC-959)
  619.     is no longer supported by any other version. 
  620.  
  621.     Since there will probably continue to be NTP and
  622.     SNTP servers of all four versions interoperating in the
  623.     Internet, careful consideration should be given to the
  624.     version used by SNTP Version 4 clients. It is
  625.     recommended that clients use the latest version known
  626.     to be supported by the selected server in the interest of
  627.     the highest accuracy and reliability. SNTP Version 4
  628.     clients can interoperate with all previous version NTP
  629.     and SNTP servers, since the header fields used by
  630.     SNTP clients are unchanged. Version 4 servers are
  631.     required to reply in the same version as the request, so
  632.     the VN field of the request also specifies the version of
  633.     the reply. 
  634.  
  635.     While not necessary in a conforming client
  636.     implementation, in unicast and anycast modes it highly
  637.     recommended that the transmit timestamp in the request
  638.     is set to the time of day according to the client clock in
  639.     NTP timestamp format. This allows a simple
  640.     calculation to determine the propagation delay between
  641.     the server and client and to align the local clock
  642.     generally within a few tens of milliseconds relative to
  643.     the server. In addition, this provides a simple method to
  644.     verify that the server reply is in fact a legitimate
  645.     response to the specific client request and avoid
  646.     replays. In multicast mode, the client has no information
  647.     to calculate the propagation delay or determine the
  648.     validity of the server, unless the NTP authentication
  649.     scheme is used. 
  650.  
  651.     To calculate the roundtrip delay d and local clock
  652.     offset t relative to the server, the client sets the transmit
  653.     timestamp in the request to the time of day according to
  654.     the client clock in NTP timestamp 
  655.     format. The server copies this field to the originate
  656.     timestamp in the reply and sets the receive timestamp
  657.     and transmit timestamp to the time of day according to
  658.     the server clock in NTP timestamp format. 
  659.  
  660.     When the server reply is received, the client determines
  661.     a Destination Timestamp variable as the time of arrival
  662.     according to its clock in NTP timestamp format. The
  663.     following table summarizes the four timestamps. 
  664.  
  665.           Timestamp Name          ID   When Generated
  666.           ------------------------------------------------------------
  667.           Originate Timestamp     T1   time request sent by client
  668.           Receive Timestamp       T2   time request received by server
  669.           Transmit Timestamp      T3   time reply sent by server
  670.           Destination Timestamp   T4   time reply received by client
  671.  
  672.     The roundtrip delay d and local clock offset t are
  673.     defined as 
  674.  
  675.           d = (T4 - T1) - (T2 - T3)     t = ((T2 - T1) + (T3 - T4)) / 2.
  676.  
  677.     The following table summarizes the SNTP client
  678.     operations in unicast, anycast and multicast modes. The
  679.     recommended error checks are shown in the Reply and
  680.     Multicast columns in the table. The message should be
  681.     considered valid only if all the fields shown contain
  682.     values in the respective ranges. Whether to believe the
  683.     message if one or more of the fields marked "ignore"
  684.     contain invalid values is at the discretion of the
  685.     implementation. 
  686.  
  687.           Field Name              Unicast/Anycast          Multicast
  688.                                   Request    Reply
  689.           ----------------------------------------------------------
  690.           LI                      0          0-2           0-2
  691.           VN                      1-4        copied from   1-4
  692.                                              request
  693.           Mode                    3          4             5
  694.           Stratum                 0          1-14          1-14
  695.           Poll                    0          ignore        ignore
  696.           Precision               0          ignore        ignore
  697.           Root Delay              0          ignore        ignore
  698.           Root Dispersion         0          ignore        ignore
  699.           Reference Identifier    0          ignore        ignore
  700.           Reference Timestamp     0          ignore        ignore
  701.           Originate Timestamp     0          (see text)    ignore
  702.           Receive Timestamp       0          (see text)    ignore
  703.           Transmit Timestamp      (see text) nonzero       nonzero
  704.           Authenticator           optional   optional      optional
  705.  
  706.     6. SNTP Server Operations
  707.  
  708.     A SNTP Version 4 server operating with either a NTP
  709.     or SNTP client of the same or previous versions retains
  710.     no persistent state. Since a SNTP server ordinarily
  711.     does not implement the full set of NTP algorithms
  712.     intended to support redundant peers and diverse
  713.     network paths, a SNTP server should be operated only
  714.     in conjunction with a source of external
  715.     synchronization, such as a reliable radio clock or
  716.     telephone modem. In this case it always operates as a
  717.     primary (stratum 1) server. 
  718.  
  719.     A SNTP server can operate in unicast mode, anycast
  720.     mode, multicast mode or any combination of these
  721.     modes. In unicast and anycast modes, the server
  722.     receives a request (mode 3), modifies certain fields in
  723.     the NTP header, and sends a reply (mode 4), possibly
  724.     using the same message buffer as the request. In anycast
  725.     mode, the server listens on the designated local
  726.     broadcast or multicast group address assigned by the
  727.     IANA, but uses its own unicast address in the source
  728.     address field of the reply. Other than the selection of
  729.     address in the reply, the operations of anycast and
  730.     unicast servers are identical. Multicast messages are
  731.     normally sent at poll intervals from 64 s to 1024 s,
  732.     depending on the expected frequency tolerance of the
  733.     client clocks and the required accuracy. 
  734.  
  735.     In unicast and anycast modes, the VN and Poll fields of
  736.     the request are copied intact to the reply. If the Mode
  737.     field of the request is 3 (client), it is set to 4 (server) in
  738.     the reply; otherwise, this field is set to 2 (symmetric
  739.     passive) in order to conform to the NTP specification.
  740.     This allows clients configured in symmetric active
  741.     (mode 1) to interoperate successfully, even if
  742.     configured in possibly suboptimal ways. In multicast
  743.     (unsolicited) mode, the VN field is set to 4, the Mode
  744.     field is set to 5 (broadcast), and the Poll field set to the
  745.     nearest integer base-2 logarithm of the poll interval. 
  746.  
  747.           Note that it is highly desirable that, if a server supports
  748.           multicast mode, it also supports unicast mode. This is so a
  749.           potential multicast client can calculate the propagation delay
  750.           using a client/server exchange prior to regular operation using
  751.           only multicast mode. If the server supports anycast mode, then it
  752.           must support unicast mode. There does not seem to be a great
  753.           advantage to operate both multicast and anycast modes at the same
  754.           time, although the protocol specification does not forbid it.
  755.  
  756.     In unicast and anycast modes, the server may or may not
  757.     respond if not synchronized to a correctly operating
  758.     radio clock, but the preferred option is to respond,
  759.     since this allows reachability to be determined
  760.     regardless of synchronization state. In multicast mode,
  761.     the server sends broadcasts only if synchronized to a
  762.     correctly operating reference clock. 
  763.  
  764.     The remaining fields of the NTP header are set in the
  765.     following way. Assuming the server is synchronized to
  766.     a radio clock or other primary reference source and
  767.     operating correctly, the LI field is set to 0 and the
  768.     Stratum field is set to 1 (primary server); if not, the
  769.     Stratum field is set to 0 and the LI field is set to 3. The
  770.     Precision field is set to reflect the maximum reading
  771.     error of the local clock. For all practical cases it is
  772.     computed as the negative of the number of significant
  773.     bits to the right of the decimal point in the NTP
  774.     timestamp format. The Root Delay and Root Dispersion
  775.     fields are set to 0 for a primary server; optionally, the
  776.     Root Dispersion field can be set to a value
  777.     corresponding to the maximum expected error of the
  778.     radio clock itself. The Reference Identifier is set to
  779.     designate the primary reference source, as indicated in
  780.     the table of Section 5 of this document. 
  781.  
  782.     The timestamp fields are set as follows. If the server is
  783.     unsynchronized or first coming up, all timestamp fields
  784.     are set to zero. If synchronized, the Reference
  785.     Timestamp is set to the time the last update was
  786.     received from the radio clock or modem. In unicast and
  787.     anycast modes, the Receive Timestamp and Transmit
  788.     Timestamp fields are set to the time of day when the
  789.     message is sent and the Originate Timestamp field is
  790.     copied unchanged from the Transmit Timestamp field
  791.     of the request. It is important that this field be copied
  792.     intact, as a NTP client uses it to avoid replays. In
  793.     multicast mode, the Originate Timestamp and Receive
  794.     Timestamp fields are set to 0 and the Transmit
  795.     Timestamp field is set to the time of day when the
  796.     message is sent. The following table summarizes these
  797.     actions. 
  798.  
  799.           Field Name              Unicast/Anycast          Multicast
  800.                                   Request    Reply
  801.           ----------------------------------------------------------
  802.           LI                      ignore     0 or 3        0 or 3
  803.           VN                      1-4        copied from   4
  804.                                              request
  805.           Mode                    3          2 or 4        5
  806.           Stratum                 ignore     1             1
  807.           Poll                    ignore     copied from   log2 poll
  808.                                              request       interval
  809.           Precision               ignore     -log2 server  -log2 server
  810.                                              significant   significant
  811.                                              bits          bits
  812.           Root Delay              ignore     0             0
  813.           Root Dispersion         ignore     0             0
  814.           Reference Identifier    ignore     source ident  source ident
  815.           Reference Timestamp     ignore     time of last  time of last
  816.                                              radio update  radio update
  817.           Originate Timestamp     ignore     copied from   0
  818.                                              transmit
  819.                                              timestamp
  820.           Receive Timestamp       ignore     time of day   0
  821.           Transmit Timestamp      (see text) time of day   time of day
  822.           Authenticator           optional   optional      optional
  823.  
  824.     There is some latitude on the part of most clients to
  825.     forgive invalid timestamps, such as might occur when
  826.     first coming up or during periods when the primary
  827.     reference source is inoperative. The most important
  828.     indicator of an unhealthy server is the LI field, in which
  829.     a value of 3 indicates an unsynchronized condition.
  830.     When this value is displayed, clients should discard the
  831.     server message, regardless of the contents of other
  832.     fields. 
  833.  
  834.     7. Configuration and Management
  835.  
  836.     Initial setup for SNTP servers and clients can be done
  837.     using a configuration file if a file system is available,
  838.     or a serial port if not. It is intended that in-service
  839.     management of NTP and SNTP Version 4 servers and
  840.     clients be performed using SNMP and a suitable MIB
  841.     to be published later. Ordinarily, SNTP servers and
  842.     clients are expected to operate with little or no
  843.     site-specific configuration, other than specifying the IP
  844.     address and subnet mask or OSI NSAP address. 
  845.  
  846.     Unicast clients must be provided with the designated
  847.     server name or address. If a server name is used, the
  848.     address of one of more DNS servers must be provided.
  849.     Multicast servers and anycast clients must be provided
  850.     with the TTL and local broadcast or multicast group
  851.     address. Anycast servers and multicast clients may be
  852.     configured with a list of address-mask pairs for access
  853.     control, so that only those clients or servers known to
  854.     be trusted will be used. These servers and clients must
  855.     implement the IGMP protocol and be provided with the
  856.     local broadcast or multicast group address as well. The
  857.     configuration data for cryptographic authentication is
  858.     beyond the scope of this document. 
  859.  
  860.     There are several scenarios which provide automatic
  861.     server discovery and selection for SNTP clients with
  862.     no pre-specified configuration, other than the IP
  863.     address and subnet mask or OSI NSAP address. For a
  864.     IP subnet or LAN segment including a fully functional
  865.     NTP server, the clients can be configured for multicast
  866.     mode using the local broadcast address. The same
  867.     approach can be used with other servers using the
  868.     multicast group address. In both cases, provision of an
  869.     access control list is a good way to insure only trusted
  870.     sources can be used to set the local clock. In another
  871.     scenario suitable for an extended network with
  872.     significant network propagation delays, clients can be
  873.     configured for anycast mode, both upon initial startup
  874.     and after some period when the currently selected
  875.     unicast source has not been heard. Following the
  876.     defined protocol, the client binds to the first reply
  877.     heard and continues operation in unicast mode. In this
  878.     mode the local clock can be automatically adjusted to
  879.     compensate for the propagation delay. 
  880.  
  881.     In still another scenario suitable for any network and
  882.     where multicast service is not available, the DNS can
  883.     be set up with a common CNAME, like
  884.     time.domain.net, and a list of address records for NTP
  885.     servers in the same domain. Upon resolving
  886.     time.domain.net and obtaining the list, the client selects
  887.     a server at random and begins operation in unicast
  888.     mode with that server. Many variations on this theme
  889.     are possible. 
  890.  
  891.     8. Acknowledgements
  892.  
  893.     Jeff Learman was helpful in developing the OSI model
  894.     for this protocol. Ajit Thyagarajan provided valuable
  895.     suggestions and corrections. 
  896.  
  897.     9. References
  898.  
  899.     [COL94] Colella, R., R. Callon, E. Gardner, Y.
  900.     Rekhter, "Guidelines for OSI NSAP allocation in the
  901.     Internet", RFC 1629, NIST, May 1994. 
  902.  
  903.     [DAR81] Postel, J., "Internet Protocol", STD 5, RFC
  904.     791, USC Information Sciences Institute, September
  905.     1981. 
  906.  
  907.     [DEE89] Deering, S., "Host extensions for IP
  908.     multicasting", STD 5, RFC 1112, Stanford University,
  909.     August 1989. 
  910.  
  911.     [DEE96] Deering, S., R. Hinden, "Internet Protocol,
  912.     Version 6 (IPv6) Specification", RFC 1883, Xerox and
  913.     Ipsilon, January 1996. 
  914.  
  915.     [DOB91] Dobbins, K, W. Haggerty, C. Shue, "OSI
  916.     connectionless transport services on top of UDP -
  917.     Version: 1", RFC 1240, Open Software Foundation,
  918.     June 1991. 
  919.  
  920.     [EAS95] Eastlake, D., 3rd., and C. Kaufman, "Domain
  921.     Name System Security Extensions", Work in Progress. 
  922.  
  923.     [FUR94] Furniss, P., "Octet sequences for upper-layer
  924.     OSI to support basic communications applications",
  925.     RFC 1698, Consultant, October 1994. [HIN96] Hinden,
  926.     R., and S. Deering, "IP Version 6 addressing
  927.     Architecture", RFC 1884, Ipsilon and Xerox, January
  928.     1996. 
  929.  
  930.     [ISO86] International Standards 8602 - Information
  931.     Processing Systems - OSI: Connectionless Transport
  932.     Protocol Specification. International Standards
  933.     Organization, December 1986. 
  934.  
  935.     [MIL92] Mills, D., "Network Time Protocol (Version
  936.     3) specification, implementation and analysis", RFC
  937.     1305, University of Delaware, March 1992. 
  938.  
  939.     [PAR93] Partridge, C., T. Mendez and W. Milliken,
  940.     "Host anycasting service", RFC 1546, Bolt Beranek
  941.     Newman, November 1993. 
  942.  
  943.     [POS80] Postel, J., "User Datagram Protocol", STD 6,
  944.     RFC 768, USC Information Sciences Institute, August
  945.     1980. 
  946.  
  947.     [POS83] Postel, J., "Time Protocol", STD 26, RFC
  948.     868, USC Information Sciences Institute, May 1983. 
  949.  
  950.     Security Considerations
  951.  
  952.     Security issues are not discussed in this memo. 
  953.  
  954.     Author's Address
  955.  
  956.        David L. Mills
  957.        Electrical Engineering Department
  958.        University of Delaware
  959.        Newark, DE 19716
  960.        Phone: (302) 831-8247
  961.  
  962.