home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 900s / rfc958.txt < prev    next >
Text File  |  1992-09-21  |  31KB  |  798 lines

  1.  
  2. Network Working Group                                         D.L. Mills
  3. Request for Comments: 958                               M/A-COM Linkabit
  4.                                                           September 1985
  5.  
  6.                       Network Time Protocol (NTP)
  7.  
  8.  
  9. Status of this Memo
  10.  
  11.    This RFC suggests a proposed protocol for the ARPA-Internet
  12.    community, and requests discussion and suggestions for improvements.
  13.    Distribution of this memo is unlimited.
  14.  
  15. Table of Contents
  16.  
  17.    1.      Introduction
  18.    2.      Service Model
  19.    3.      Protocol Overview
  20.    4.      State Variables and Formats
  21.    5.      Protocol Operation
  22.    5.1.    Protocol Modes
  23.    5.2.    Message Processing
  24.    5.3.    Network Considerations
  25.    5.4.    Leap Seconds
  26.    6.      References
  27.    Appendix A. UDP Header Format
  28.    Appendix B. NTP Data Format
  29.  
  30. 1.  Introduction
  31.  
  32.    This document describes the Network Time Protocol (NTP), a protocol
  33.    for synchronizing a set of network clocks using a set of distributed
  34.    clients and servers.  NTP is built on the User Datagram Protocol
  35.    (UDP) [13], which provides a connectionless transport mechanism.  It
  36.    is evolved from the Time Protocol [7] and the ICMP Timestamp message
  37.    [6] and is a suitable replacement for both.
  38.  
  39.    NTP provides the protocol mechanisms to synchronize time in principle
  40.    to precisions in the order of nanoseconds while preserving a
  41.    non-ambiguous date, at least for this century.  The protocol includes
  42.    provisions to specify the precision and estimated error of the local
  43.    clock and the characteristics of the reference clock to which it may
  44.    be synchronized.  However, the protocol itself specifies only the
  45.    data representation and message formats and does not specify the
  46.    synchronizing algorithms or filtering mechanisms.
  47.  
  48.    Other mechanisms have been specified in the Internet protocol suite
  49.    to record and transmit the time at which an event takes place,
  50.    including the Daytime protocol [8] and IP Timestamp option [9].  The
  51.    NTP is not meant to displace either of these mechanisms.  Additional
  52.    information on network time synchronization can be found in the
  53.  
  54.  
  55. Mills                                                           [Page 1]
  56.  
  57.  
  58.  
  59. RFC 958                                                        September
  60. Network Time Protocol
  61.  
  62.  
  63.    References at the end of this document.  An earlier synchronization
  64.    protocol is discussed in [3] and synchronization algorithms in [2],
  65.    [5], [10] and [12]. Experimental results on measured roundtrip delays
  66.    and clock offsets in the Internet are discussed in [4] and [11].  A
  67.    comprehensive mathematical treatment of clock synchronization can be
  68.    found in [1].
  69.  
  70. 2.  Service Model
  71.  
  72.    The intent of the service for which this protocol is designed is to
  73.    connect a few primary reference clocks, synchronized by wire or radio
  74.    to national standards, to centrally accessable resources such as
  75.    gateways. These gateways would use NTP between them to cross-check
  76.    the primary clocks and mitigate errors due to equipment or
  77.    propagation failures. Some number of local-net hosts, serving as
  78.    secondary reference clocks, would run NTP with one or more of these
  79.    gateways.  In order to reduce the protocol overhead, these hosts
  80.    would redistribute time to the remaining local-net hosts.  In the
  81.    interest of reliability selected hosts might be equipped with less
  82.    accurate but less expensive radio clocks and used for backup in case
  83.    of failure of the primary and/or secondary clocks or communication
  84.    paths between them.
  85.  
  86.    In the normal configuration a subnetwork of primary and secondary
  87.    clocks will assume a hierarchical organization with the more accurate
  88.    clocks near the top and the less accurate below.  NTP provides
  89.    information that can be used to organize this hierarchy on the basis
  90.    of precision or estimated error and even to serve as a rudimentary
  91.    routing algorithm to organize the subnetwork itself.  However, the
  92.    NTP protocol does not include a specification of the algorithms for
  93.    doing this, which is left as a topic for further study.
  94.  
  95. 3.  Protocol Overview
  96.  
  97.    There is no provision for peer discovery, acquisition, or
  98.    authentication in NTP.  Data integrity is provided by the IP and UDP
  99.    checksums.  No reachability, circuit-management, duplicate-detection
  100.    or retransmission facilities are provided or necessary.  The service
  101.    can operate in a symmetric mode, in which servers and clients are
  102.    indistinguishable yet maintain a small amount of state information,
  103.    or in an unsymmetric mode in which servers need maintain no client
  104.    state other than that contained in the client request.  Moreover,
  105.    only a single NTP message format is necessary, which simplifies
  106.    implementation and can be used in a variety of solicited or
  107.    unsolicited polling mechanisms.
  108.  
  109.    In what may be the most common (unsymmetric) mode a client sends an
  110.  
  111.  
  112. Mills                                                           [Page 2]
  113.  
  114.  
  115.  
  116. RFC 958                                                        September
  117. Network Time Protocol
  118.  
  119.  
  120.    NTP message to one or more servers and processes the replies as
  121.    received.  The server interchanges addresses and ports, fills in or
  122.    overwrites certain fields in the message, recalculates the checksum
  123.    and returns it immediately.  Information included in the NTP message
  124.    allows each client/server peer to determine the timekeeping
  125.    characteristics of its other peers, including the expected accuracies
  126.    of their clocks. Using this information each peer is able to select
  127.    the best time from possibly several other clocks, update the local
  128.    clock and estimate its accuracy.
  129.  
  130.    It should be recognized that clock synchronization requires by its
  131.    nature long periods and multiple comparisons in order to maintain
  132.    accurate timekeeping.  While only a few comparisons are usually
  133.    adequate to maintain local time to within a second, primarily to
  134.    protect against broken hardware or synchronization failure, periods
  135.    of hours or days and tens or hundreds of comparisons are required to
  136.    maintain local time to within a few tens of milliseconds.
  137.    Fortunately, the frequency of comparisons can be quite small and
  138.    almost always non-intrusive to normal network operations.
  139.  
  140. 4.  State Variables and Formats
  141.  
  142.    NTP timestamps are represented as a 64-bit fixed-point number, in
  143.    seconds relative to 0000 UT on 1 January 1900.  The integer part is
  144.    in the first 32 bits and the fraction part in the last 32 bits, as
  145.    shown in the following diagram.
  146.  
  147.        0                   1                   2                   3   
  148.        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 
  149.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  150.       |                         Integer Part                          |
  151.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  152.       |                         Fraction Part                         |
  153.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  154.  
  155.    This format allows convenient multiple-precision arithmetic and
  156.    conversion to Time Protocol representation (seconds), but does
  157.    complicate the conversion to ICMP Timestamp message representation
  158.    (milliseconds).  The low-order fraction bit increments at about
  159.    0.2-nanosecond intervals, so a free-running one-millisecond clock
  160.    will be in error only a small fraction of one part per million, or
  161.    less than a second per year.
  162.  
  163.    In some cases a particular timestamp may not be available, such as
  164.    when the protocol first starts up.  In these cases the 64-bit field
  165.    is set to zero, indicating the value is invalid or undefined.
  166.  
  167.  
  168.  
  169. Mills                                                           [Page 3]
  170.  
  171.  
  172.  
  173. RFC 958                                                        September
  174. Network Time Protocol
  175.  
  176.  
  177.    Following is a description of the various data items used in the
  178.    protocol.  Details of packet formats are presented in the Appendices.
  179.  
  180.    Leap Indicator
  181.  
  182.       This is a two-bit code warning of an impending leap-second to be
  183.       inserted in the internationally coordinated Standard Time
  184.       broadcasts.  A leap-second is occasionally added or subtracted
  185.       from Standard Time, which is based on atomic clocks, to maintain
  186.       agreement with Earth rotation.  When necessary, the corrections
  187.       are notified in advance and executed at the end of the last day of
  188.       the month in which notified, usually June or December.  When a
  189.       correction is executed the first minute of the following day will
  190.       have either 59 or 61 seconds.
  191.  
  192.    Status
  193.  
  194.       This is a six-bit code indicating the status of the local clock.
  195.       Values are assigned to indicate whether it is operating correctly
  196.       or in one of several error states.
  197.  
  198.    Reference Clock Type
  199.  
  200.       This is an eight-bit code identifying the type of reference clock
  201.       used to set the local clock.  Values are assigned for primary
  202.       clocks (locally synchronized to Standard Time), secondary clocks
  203.       (remotely synchronized via various network protocols) and even
  204.       eyeball-and-wristwatch.
  205.  
  206.    Precision
  207.  
  208.       This is a 16-bit signed integer indicating the precision of the
  209.       local clock, in seconds to the nearest power of two.  For
  210.       instance, a 60-Hz line-frequency clock would be assigned the value
  211.       -6, while a 1000-Hz crystal clock would be assigned the value -10.
  212.  
  213.    Estimated Error
  214.  
  215.       This is a 32-bit fixed-point number indicating the estimated error
  216.       of the local clock at the time last set.  The value is in seconds,
  217.       with fraction point between bits 15 and 16, and is computed by the
  218.       sender based on the reported error of the reference clock, the
  219.       precision and drift rate of the local clock and the time the local
  220.       clock was last set.  For statistical purposes this quantity can be
  221.       assumed equal to the estimated or computed standard deviation, as
  222.       described in [12].
  223.  
  224.  
  225.  
  226. Mills                                                           [Page 4]
  227.  
  228.  
  229.  
  230. RFC 958                                                        September
  231. Network Time Protocol
  232.  
  233.  
  234.    Estimated Drift Rate
  235.  
  236.       This is a 32-bit signed fixed-point number indicating the
  237.       estimated drift rate of the local clock.  The value is
  238.       dimensionless, with fraction point to the left of the high-order
  239.       bit.  While for most purposes this value can be estimated based on
  240.       the hardware characteristics, it is possible to compute it quite
  241.       accurately, as described in [12].
  242.  
  243.    Reference Clock Identifier
  244.  
  245.       This is a 32-bit code identifying the particular reference clock.
  246.       The interpretation of its value depends on value of Reference
  247.       Clock Type.  In the case of a primary clock locally synchronized
  248.       to Standard Time (type 1), the value is an ASCII string
  249.       identifying the clock.  In the case of a secondary clock remotely
  250.       synchronized to an Internet host via NTP (type 2), the value is
  251.       the 32-bit Internet address of that host.  In other cases the
  252.       value is undefined.
  253.  
  254.    Reference Timestamp
  255.  
  256.       This is a 64-bit timestamp established by the server or client
  257.       host as the timestamp (presumably obtained from a reference clock)
  258.       most recently used to update the local clock.  If the local clock
  259.       has never been synchronized, the value is zero.
  260.  
  261.    Originate Timestamp
  262.  
  263.       This is a 64-bit timestamp established by the client host and
  264.       specifying the local time at which the request departed for the
  265.       service host.  It will always have a nonzero value.
  266.  
  267.    Receive Timestamp
  268.  
  269.       This is a 64-bit timestamp established by the server host and
  270.       specifying the local time at which the request arrived from the
  271.       client host.  If no request has ever arrived from the client the
  272.       value is zero.
  273.  
  274.    Transmit Timestamp
  275.  
  276.       This is a 64-bit timestamp established by the server host and
  277.       specifying the local time at which the reply departed for the
  278.       client host.  If no request has ever arrived from the client the
  279.       value is zero.
  280.  
  281.  
  282.  
  283. Mills                                                           [Page 5]
  284.  
  285.  
  286.  
  287. RFC 958                                                        September
  288. Network Time Protocol
  289.  
  290.  
  291. 5.  Protocol Operation
  292.  
  293.    The intent of this document is to specify a standard for data
  294.    representation and message format which can be used for a variety of
  295.    synchronizing algorithms and filtering mechanisms.  Accordingly, the
  296.    information in this section should be considered a guide, rather than
  297.    a concise specification.  Nevertheless, it is expected that a
  298.    standard Internet distributed timekeeping protocol with concisely
  299.    specified synchronizing and filtering algorithms can be evolved from
  300.    the information in this section.
  301.  
  302.    5.1.  Protocol Modes
  303.  
  304.       The distinction between client and server is significant only in
  305.       the way they interact in the request/response interchange.  The
  306.       same NTP message format is used by each peer and contains the same
  307.       data relative to the other peer.  In the unsymmetric mode the
  308.       client periodically sends an NTP message to the server, which then
  309.       responds within some interval.  Usually, the server simply
  310.       interchanges addresses and ports, fills in the required
  311.       information and sends the message right back. Servers operating in
  312.       the unsymmetric mode then need retain no state information between
  313.       client requests.
  314.  
  315.       In the symmetric mode the client/server distinction disappears.
  316.       Each peer maintains a table with as many entries as active peers,
  317.       each entry including a code uniquely identifying the peer (e.g.
  318.       Internet address), together with status information and a copy of
  319.       the Originate Timestamp and Receive Timestamp values last received
  320.       from that peer. The peer periodically sends an NTP message to each
  321.       of these peers including the latest copy of these timestamps.  The
  322.       interval between sending NTP messages is managed solely by the
  323.       sending peer and is unaffected by the arrival of NTP messages from
  324.       other peers.
  325.  
  326.       The mode assumed by a peer can be determined by inspection of the
  327.       UDP Source Port and Destination Port fields (see Appendix A).  If
  328.       both of these fields contain the NTP service-port number 123, the
  329.       peer is operating in symmetric mode.  If they are different and
  330.       the Destination Port field contains 123, this is a client request
  331.       and the receiver is expected to reply in the manner described
  332.       above.  If they are different and the Source Port field contains
  333.       123, this is a server reply to a previously sent client request.
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340. Mills                                                           [Page 6]
  341.  
  342.  
  343.  
  344. RFC 958                                                        September
  345. Network Time Protocol
  346.  
  347.  
  348.    5.2.  Message Processing
  349.  
  350.       The significant events of interest in NTP occur usually near the
  351.       times the NTP messages depart and arrive the client/server.  In
  352.       order to maintain the highest accuracy it is important that the
  353.       timestamps associated with these events be computed as close as
  354.       possible to the hardware or software driver associated with the
  355.       communications link and, in particular, that departure timestamps
  356.       be recomputed for each retransmission, if used at the link level.
  357.  
  358.       An NTP message is constructed as follows (see Appendix B).  The
  359.       source peer constructs the UDP header and the LI, Status,
  360.       Reference Clock Type and Precision fields in the NTP data portion.
  361.       Next, it determines the current synchronizing source and
  362.       constructs the Type and Reference Clock Identifier fields.  From
  363.       its timekeeping algorithm (see [12] for examples) it determines
  364.       the Reference Timestamp, Estimated Error and Estimated Drift Rate
  365.       fields.  Then it copies into the Receive Timestamp and Transmit
  366.       Timestamp fields the data saved from the latest message received
  367.       from the destination peer and, finally, computes the Originate
  368.       Timestamp field.
  369.  
  370.       The destination peer calculates the roundtrip delay and clock
  371.       offset relative to the source peer as follows.  Let t1, t2 and t3
  372.       represent the contents of the Originate Timestamp, Receive
  373.       Timestamp and Transmit Timestamp fields and t4 the local time the
  374.       NTP message is received.  Then the roundtrip delay d and clock
  375.       offset c is:
  376.  
  377.          d = (t4 - t1) - (t3 - t2)  and  c = (t2 - t1 + t3 - t4)/2 .
  378.  
  379.       The implicit assumption in the above is that the one-way delay is
  380.       statistically half the roundtrip delay and that the intrinsic
  381.       drift rates of both the client and server clocks are small and
  382.       close to the same value.
  383.  
  384.    5.3.  Network Considerations
  385.  
  386.       The client/server peers have an opportunity to learn a good deal
  387.       about each other in the NTP message exchange.  For instance, each
  388.       can learn about the characteristics of the other clocks and select
  389.       among them the most accurate to use as reference clock, compute
  390.       the estimated error and drift rate and use this information to
  391.       manage the dynamics of the subnetwork of clocks.  An outline of a
  392.       suggested mechanism is as follows:
  393.  
  394.       Included in the table of timestamps for each peer are state
  395.  
  396.  
  397. Mills                                                           [Page 7]
  398.  
  399.  
  400.  
  401. RFC 958                                                        September
  402. Network Time Protocol
  403.  
  404.  
  405.       variables to indicate the precision, as well as the current
  406.       estimated delay, offset, error and drift rate of its local clock.
  407.       These variables are updated for each NTP message received from the
  408.       peer, after which the estimated error is periodically recomputed
  409.       on the basis of elapsed time and estimated drift rate.
  410.  
  411.       Assuming symmetric mode, a polling interval is established for
  412.       each peer, depending upon its normal synchronization source,
  413.       precision and intrinsic accuracy, which might be determined in
  414.       advance or even as the result of observation.  The delay and
  415.       clock-offset samples obtained can be filtered using
  416.       maximum-likelihood techniques and algorithms described in [12].
  417.  
  418.       From time to time a local-clock correction is computed from the
  419.       offset data accumulated as above, perhaps using algorithms
  420.       described in [10] and [12].  The correction causes the local clock
  421.       to run slightly fast or slow to the corrected time or to jump
  422.       instantaneously to the correct time, depending on the magnitude of
  423.       the correction.  See [5] and [11] for a discussion of local-clock
  424.       implementation models and synchronizing algorithms.  Note that the
  425.       expectation here is that all network clocks are maintained by
  426.       these algorithms, so that manual intervention is not normally
  427.       required.
  428.  
  429.       As a byproduct of the above operations an estimate of local-clock
  430.       error and drift rate can be computed.  Note that the magnitude of
  431.       the error estimate must always be greater than that of the
  432.       selected reference clock by at least the inherent precision of the
  433.       local clock. It does not take a leap of imagination to see that
  434.       the estimated error, delay or precision, or some combination of
  435.       them, can be used as a metric for a simple min-hop-type routing
  436.       algorithm to organize the subnetwork so as to provide the most
  437.       accurate time to all peers and to provide automatic fallback to
  438.       alternate sources in case of failures.
  439.  
  440.       A variety of network configurations can be included in the above
  441.       scenario.  In the case of networks supporting a broadcast
  442.       function, for example, NTP messages can be broadcast from one or
  443.       more server hosts and picked up by client hosts sharing the same
  444.       cable.  Since typical networks of this type have a very low
  445.       propagation delay, the roundtrip-delay calculation can be omitted
  446.       and the clients need not broadcast in return.  Thus, the
  447.       requirement to save per-peer timestamps is removed, so that the
  448.       Receive Timestamp and Transmit Timestamp fields can be set to zero
  449.       and the local-clock offset becomes simply the difference between
  450.       the Originate Timestamp and the local time upon arrival.  In the
  451.       case of long-delay satellite networks with broadcast capabilities,
  452.  
  453.  
  454. Mills                                                           [Page 8]
  455.  
  456.  
  457.  
  458. RFC 958                                                        September
  459. Network Time Protocol
  460.  
  461.  
  462.       an accurate measure of roundtrip delay is usually available from
  463.       the channel-scheduling algorithm, so the per-peer timestamps again
  464.       can be avoided.
  465.  
  466.    5.4.  Leap Seconds
  467.  
  468.       A standard mechanism to effect leap-second correction is not a
  469.       part of this specification.  It is expected that the Leap
  470.       Indicator bits would be set by hand in the primary reference
  471.       clocks, then trickle down to all other clocks in the network,
  472.       which would execute the correction at the specified time and reset
  473.       the bits.
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511. Mills                                                           [Page 9]
  512.  
  513.  
  514.  
  515. RFC 958                                                        September
  516. Network Time Protocol
  517.  
  518.  
  519. 6.  References
  520.  
  521.    1.  Lindsay, W.C., and A.V.  Kantak.  Network Synchronization of
  522.        Random Signals.  IEEE Trans.  Comm.  COM-28, 8 (August 1980),
  523.        1260-1266.
  524.  
  525.    2.  Mills, D.L.  Time Synchronization in DCNET Hosts.  DARPA Internet
  526.        Project Report IEN-173, COMSAT Laboratories, February 1981.
  527.  
  528.    3.  Mills, D.L.  DCNET Internet Clock Service.  DARPA Network Working
  529.        Group Report RFC-778, COMSAT Laboratories, April 1981.
  530.  
  531.    4.  Mills, D.L.  Internet Delay Experiments.  DARPA Network Working
  532.        Group Report RFC-889, M/A-COM Linkabit, December 1983.
  533.  
  534.    5.  Mills, D.L.  DCN Local-Network Protocols.  DARPA Network Working
  535.        Group Report RFC-891, M/A-COM Linkabit, December 1983.
  536.  
  537.    6.  Postel, J.  Internet Control Message Protocol.  DARPA Network
  538.        Working Group Report RFC-792, USC Information Sciences Institute,
  539.        September 1981.
  540.  
  541.    7.  Postel, J.  Time Protocol.  DARPA Network Working Group Report
  542.        RFC-868, USC Information Sciences Institute, May 1983.
  543.  
  544.    8.  Postel, J.  Daytime Protocol.  DARPA Network Working Group Report
  545.        RFC-867, USC Information Sciences Institute, May 1983.
  546.  
  547.    9.  Su, Z.  A Specification of the Internet Protocol (IP) Timestamp
  548.        Option.  DARPA Network Working Group Report RFC-781.  SRI
  549.        International, May 1981.
  550.  
  551.    10. Marzullo, K., and S.  Owicki.  Maintaining the Time in a
  552.        Distributed System.  ACM Operating Systems Review 19, 3 (July
  553.        1985), 44-54.
  554.  
  555.    11. Mills, D.L.  Experiments in Network Clock Synchronization.  DARPA
  556.        Network Working Group Report RFC-957, M/A-COM Linkabit, August
  557.        1985.
  558.  
  559.    12. Mills, D.L.  Algorithms for Synchronizing Network Clocks.  DARPA
  560.        Network Working Group Report RFC-956, M/A-COM Linkabit, September
  561.        1985.
  562.  
  563.    13. Postel, J.  User Datagram Protocol.  DARPA Network Working Group
  564.        Report RFC-768, USC Information Sciences Institute, August 1980.
  565.  
  566.  
  567.  
  568. Mills                                                          [Page 10]
  569.  
  570.  
  571.  
  572. RFC 958                                                        September
  573. Network Time Protocol
  574.  
  575.  
  576. Appendix A.  UDP Header Format
  577.  
  578.    An NTP packet consists of the UDP header followed by the NTP data
  579.    portion.  The format of the UDP header and the interpretation of its
  580.    fields are described in [13] and are not part of the NTP
  581.    specification.  They are shown below for completeness.
  582.  
  583.     0                   1                   2                   3   
  584.     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 
  585.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  586.    |          Source Port          |       Destination Port        |
  587.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  588.    |            Length             |           Checksum            |
  589.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  590.  
  591.    Source Port
  592.  
  593.       UDP source port number. In the case of unsymmetric mode and a
  594.       client request this field is assigned by the client host, while
  595.       for a server reply it is copied from the Destination Port field of
  596.       the client request.  In the case of symmetric mode, both the
  597.       Source Port and Destination Port fields are assigned the NTP
  598.       service-port number 123.
  599.  
  600.    Destination Port
  601.  
  602.       UDP destination port number. In the case of unsymmetric mode and a
  603.       client request this field is assigned the NTP service-port number
  604.       123, while for a server reply it is copied form the Source Port
  605.       field of the client request.  In the case of symmetric mode, both
  606.       the Source Port and Destination Port fields are assigned the NTP
  607.       service-port number 123.
  608.  
  609.    Length
  610.  
  611.       Length of the request or reply, including UDP header, in octets.
  612.  
  613.    Checksum
  614.  
  615.       Standard UDP checksum.
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625. Mills                                                          [Page 11]
  626.  
  627.  
  628.  
  629. RFC 958                                                        September
  630. Network Time Protocol
  631.  
  632.  
  633. Appendix B.  NTP Data Format
  634.  
  635.    The format of the NTP data portion, which immediately follows the UDP
  636.    header, is shown below along with a description of its fields.
  637.  
  638.     0                   1                   2                   3   
  639.     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 
  640.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  641.    |LI |   Status  |      Type     |           Precision           |
  642.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  643.    |                       Estimated Error                         |
  644.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  645.    |                     Estimated Drift Rate                      |
  646.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  647.    |                  Reference Clock Identifier                   |
  648.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  649.    |                                                               |
  650.    |                 Reference Timestamp (64 bits)                 |
  651.    |                                                               |
  652.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  653.    |                                                               |
  654.    |                 Originate Timestamp (64 bits)                 |
  655.    |                                                               |
  656.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  657.    |                                                               |
  658.    |                  Receive Timestamp (64 bits)                  |
  659.    |                                                               |
  660.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  661.    |                                                               |
  662.    |                  Transmit Timestamp (64 bits)                 |
  663.    |                                                               |
  664.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  665.  
  666.    Leap Indicator (LI)
  667.  
  668.       Code warning of impending leap-second to be inserted at the end of
  669.       the last day of the current month. Bits are coded as follows:
  670.  
  671.          00      no warning
  672.          01      +1 second (following minute has 61 seconds)
  673.          10      -1 second (following minute has 59 seconds)
  674.          11      reserved for future use
  675.  
  676.    Status
  677.  
  678.       Code indicating status of local clock. Values are defined as
  679.       follows:
  680.  
  681.  
  682. Mills                                                          [Page 12]
  683.  
  684.  
  685.  
  686. RFC 958                                                        September
  687. Network Time Protocol
  688.  
  689.  
  690.          0       clock operating correctly
  691.          1       carrier loss
  692.          2       synch loss
  693.          3       format error
  694.          4       interface (Type 1) or link (Type 2) failure
  695.          (additional codes reserved for future use)
  696.  
  697.    Reference Clock Type
  698.    (Type)
  699.  
  700.       Code identifying the type of reference clock. Values are defined
  701.       as follows:
  702.  
  703.          0       unspecified
  704.          1       primary reference (e.g. radio clock)
  705.          2       secondary reference using an Internet host via NTP
  706.          3       secondary reference using some other host or protocol
  707.          4       eyeball-and-wristwatch
  708.          (additional codes reserved for future use)
  709.  
  710.    Precision
  711.  
  712.       Signed integer in the range +32 to -32 indicating the precision of
  713.       the local clock, in seconds to the nearest power of two.
  714.  
  715.    Estimated Error
  716.  
  717.       Fixed-point number indicating the estimated error of the local
  718.       clock at the time last set, in seconds with fraction point between
  719.       bits 15 and 16.
  720.  
  721.    Estimated Drift Rate
  722.  
  723.       Signed fixed-point number indicating the estimated drift rate of
  724.       the local clock, in dimensionless units with fraction point to the
  725.       left of the high-order bit.
  726.  
  727.    Reference Clock
  728.    Identifier
  729.  
  730.       Code identifying the particular reference clock. In the case of
  731.       type 1 (primary reference), this is a left-justified, zero-filled
  732.       ASCII string identifying the clock, for example:
  733.  
  734.          WWVB    WWVB radio clock (60 KHz)
  735.  
  736.  
  737.  
  738.  
  739. Mills                                                          [Page 13]
  740.  
  741.  
  742.  
  743. RFC 958                                                        September
  744. Network Time Protocol
  745.  
  746.  
  747.          GOES    GOES satellite clock (468 HMz)
  748.          WWV     WWV radio clock (2.5/5/10/15/20 MHz)
  749.          (and others as necessary)
  750.  
  751.       In the case of type 2 (secondary reference) this is the 32-bit
  752.       Internet address of the reference host. In other cases this field
  753.       is reserved for future use and should be set to zero.
  754.  
  755.    Reference Timestamp
  756.  
  757.       Local time at which the local clock was last set or corrected.
  758.  
  759.    Originate Timestamp
  760.  
  761.       Local time at which the request departed the client host for the
  762.       service host.
  763.  
  764.    Receive Timestamp
  765.  
  766.       Local time at which the request arrived at the service host.
  767.  
  768.    Transmit Timestamp
  769.  
  770.       Local time at which the reply departed the service host for the
  771.       client host.
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. Mills                                                          [Page 14]
  797.  
  798.