NTP
Click on the red underlined text to get to the source
...
This document describes the Network Time Protocol (NTP), including
the architectures, algorithms ...
... 958(-> 1305draft | 1119(-> 1305draft) | 1059(-> 1305draft | 1119(-> 1305draft))) [24], but has evolved in significant ways
since publication of that document. NTP is built on the Internet
Protocol (IP) [10 ...
... requirement for an election protocol.
NTP itself is described in Section 3. It provides the protocol
mechanisms to synchronize time in principle to precisions in the
order of nanoseconds while preserving a non-ambiguous date well into
...
... been developed and are described in Section 4.
The accuracies achievable by NTP depend strongly on the precision of
the local clock hardware and stringent control of device and process
...
... logical clock time and frequency in response to corrections produced
by NTP. Section 5 describes a logical clock design evolved from the
Fuzzball implementation described in [15]. This design includes
...
...
The UDP and NTP packet formats are shown in Appendices A and B.
Appendix C presents the results of a survey of about 5500 Internet ...
... Internet
hosts showing how their clocks compare with primary reference sources
using three different time protocols, including NTP. Appendix D
presents experimental results using several different deglitching and
...
... experimental results using several different deglitching and
smoothing algorithms. Appendix E describes the prototype NTP primary
service net, as well as proposed rules of engagement for its use.
...
... 17], [20] and [28]. NTP uses techniques
evolved from both linear and nonlinear synchronization methodology.
...
... routing protocol
design. One or more processes synchronize to an external reference
source, such as a radio clock or NTP daemon, and the routing
algorithm constructs a minimum-weight spanning tree rooted on these
...
... process clocks corrected using the procedure described in Section 5
of this document. While it can be seen that the design of Hellospeak
strongly influenced the design of NTP, Hellospeak itself is not an
Internet protocol and is unsuited for use outside its local-net
...
... overheads of the election process, the offset measurement/correction
process requires twice as many messages as NTP per update.
...
... involves mutually coupled oscillators and maximum-likelihood
estimation and selection procedures. From the analytical point of
view, the system of distributed NTP peers operates as a set of
coupled phase-locked oscillators, with the update algorithm
...
... subnet self-organizes into a hierarchical master-slave configuration
[5]. What makes the NTP model unique is the adaptive configuration,
polling, filtering and selection functions which tailor the dynamics
...
...
The purpose of NTP is to connect a number of primary reference
sources, synchronized to national standards by wire or radio, to
widely accessible resources such as backbone ...
... gateways, acting as primary time servers, use NTP between them to
cross-check the clocks and mitigate errors due to equipment or
propagation failures. Some number of local-net hosts ...
... gateways,
acting as secondary time servers, run NTP with one or more of the
primary servers. In order to reduce the protocol overhead the
...
... primary servers. In order to reduce the protocol overhead the
secondary servers distribute time via NTP to the remaining local-net
hosts. In the interest of reliability ...
... There is no provision for peer discovery, acquisition, or
authentication in NTP. Data integrity is provided by the IP and UDP
checksums ...
... state information and reduce resource requirements. Since only a
single NTP message format is used, the protocol is easily implemented
and can be used in a variety of solicited or unsolicited polling
...
... client/server model a client sends an
NTP message to one or more servers and processes the replies as
received. The server interchanges addresses and ports ...
... certain fields in the message, recalculates the checksum and returns
the message immediately. Information included in the NTP message
allows the client to determine the server time ...
... involving a public server and perhaps many workstation clients, the
full generality of NTP requires distributed participation of a number
of client/servers or peers arranged in a dynamically reconfigurable,
...
... timers for each peer,
collects information in the data base and sends NTP messages to other
peers in the net. Each message contains the local time the message
is sent, together with previously received information and other
...
... local system, as well as its peers.
The receive process receives NTP messages and perhaps messages in
other protocols as well, including ICMP, other UDP ...
... TCP time
protocols, local-net protocols and directly connected radio clocks.
When an NTP message is received the offset between the sender clock
and the local clock is computed and incorporated into the data base ...
... provides a stable source of time information to other users of the
system and for subsequent reference by NTP itself.
...
... filter and selection algorithms
used in NTP accomplish this by using a variant of the Bellman-Ford
distributed routing algorithm [29 ...
...
Like UTC, NTP operates with an abstract oscillator synchronized in
frequency to the TA time scale. At 0000 hours on 1 January 1972 the
...
... frequency to the TA time scale. At 0000 hours on 1 January 1972 the
NTP time scale was set to 2,272,060,800, representing the number of
TA seconds since 0000 hours on 1 January 1900. The insertion of leap
...
... TA and UTC, or conventional civil time. However,
since the only institutional memory assumed by NTP is the UTC radio
broadcast ...
... broadcast service, the NTP time scale is in effect reset to UTC as
each offset estimate is computed. When a leap second is inserted in
...
... each offset estimate is computed. When a leap second is inserted in
UTC and subsequently in NTP, knowledge of all previous leap seconds
is lost. Thus, if a clock synchronized to NTP in early 1988 was used
...
... UTC and subsequently in NTP, knowledge of all previous leap seconds
is lost. Thus, if a clock synchronized to NTP in early 1988 was used
to establish the time of an event that occured in early 1972, it
would be fourteen seconds early.
...
... would be fourteen seconds early.
When NTP is used to measure intervals between events that straddle a
leap second, special considerations apply. When it is necessary to
determine the elapsed time ...
... determine the elapsed time between events, such as the half life of a
proton, NTP timestamps of these events can be used directly. When it
is necessary to establish the order of events relative to UTC ...
... is necessary to establish the order of events relative to UTC, such
as the order of funds transfers, NTP timestamps can also be used
directly; however, if it is necessary to establish the elapsed time ...
... UTC, such as the intervals between
payments on a mortgage, NTP timestamps must be converted to UTC using
...
... 2] do not
include provisions for advance notice of leap seconds, so this
information must be determined from other sources. NTP includes
provisions to distribute advance warnings of leap seconds using the
Leap Indicator bits ...
... is not intended that this model is the only one upon which a
specification can be based. In particular, the specification is
intended to illustrate and clarify the intrinsic operations of NTP
and serve as a foundation for a more rigorous, comprehensive and
verifiable specification.
...
... represented by the full field width is seldom justified.
Since NTP timestamps are cherished data and, in fact, represent the
main product of the protocol, a special timestamp format ...
... main product of the protocol, a special timestamp format has been
established. NTP timestamps are represented as a 64-bit unsigned
...
... Integer Part) has been set and that the 64-bit field will
overflow some time in 2036. Should NTP be in use in 2036, some
external means will be necessary to qualify time relative to 1900 and
time relative to 2036 (and other multiples of 136 years).
...
... each peer operating in symmetric mode or client mode; packet
variables, which represent the contents of the NTP message; and
parameters, which are fixed in all implementations of the current
version. For each class ...
... Parameters Name Value
-------------------------------------------------------
NTP Version NTP.VERSION 1
...
... NTP.PORT 123
Minimum Polling Interval NTP.MINPOLL 6 (64 sec)
Maximum Polling Interval NTP.MAXPOLL 10 (1024
...
... Minimum Polling Interval NTP.MINPOLL 6 (64 sec)
Maximum Polling Interval NTP.MAXPOLL 10 (1024
sec)
Maximum Dispersion NTP ...
... This is a two-bit code warning of an impending leap second to be
inserted in the NTP time scale. The bits are set before 23:59 on
the day of insertion and reset after 00:01 on the following day.
...
...
In all except the alarm condition (11) NTP itself does nothing
with these bits, except pass them on to the time-conversion
...
... with these bits, except pass them on to the time-conversion
routines that are not part of NTP. The alarm condition occurs
when, for whatever reason, the logical clock is not synchronized,
...
... value of zero is interpreted as unspecified, one as a primary
clock (synchronized by outside means) and remaining values as the
stratum level (synchronized by NTP). For comparison purposes a
value of zero is considered greater than any other value.
...
...
indicates a minimum interval of 64 seconds. The value of this
variable must not be less than NTP.MINPOLL and must not be greater
than NTP.MAXPOLL.
...
... variable must not be less than NTP.MINPOLL and must not be greater
than NTP.MAXPOLL.
Precision (sys.precision, peer.precision, pkt.precision)
...
... ASCII string identifying the reason or clock,
respectively. For stratum values greater than one (synchronized
by NTP), the value is the 32-bit Internet address of the reference
...
... peer, in seconds as a power of two. For instance, a value of six
indicates a minimum interval of 64 seconds. The value of this
variable must not be less than NTP.MINPOLL and must not be greater
than NTP.MAXPOLL.
...
... variable must not be less than NTP.MINPOLL and must not be greater
than NTP.MAXPOLL.
Reachability ...
... timestamp format, at the peer when its
latest NTP message was sent. If the peer becomes unreachable the
value is set to zero.
...
...
This is the local time, in timestamp format, when the latest NTP
message from the peer arrived. If the peer becomes unreachable
the value is set to zero ...
...
Following is a list of variables used in NTP messages in addition to
the common variables above.
...
... version number of the sender.
NTP messages will always be sent with the current version number
NTP ...
... NTP messages will always be sent with the current version number
NTP.VERSION and will always be accepted if the version number
...
... VERSION and will always be accepted if the version number
matches NTP.VERSION. Exceptions may be advised on a case-by-case
basis at times when the version number ...
... port number (123) assigned by the Internet Number Czar
to NTP.
Minimum Polling Interval (NTP ...
... NTP.
Minimum Polling Interval (NTP.MINPOLL)
This is the minimum polling interval allowed by any peer of the
...
... Internet system, currently set to 6 (64 seconds).
Maximum Polling Interval (NTP.MAXPOLL)
This is the maximum polling interval allowed by any peer of the
...
... Internet system, currently set to 10 (1024 seconds).
Maximum Dispersion (NTP.MAXDISP)
This is the maximum dispersion assumed by the filter ...
... port (peer.srcport) or destination port (peer.dstport) peer variables
contain the assigned NTP service port number NTP.PORT ...
... contain the assigned NTP service port number NTP.PORT (123) as shown
in the following table.
...
... peer.srcport peer.dstport Mode
-------------------------------------------
not NTP.PORT not NTP.PORT ...
... A host operating in client mode occasionally sends an NTP message to
a host operating in server mode. The server responds by simply
...
... client requests. Clients
are free to manage the intervals between sending NTP messages to suit
local conditions.
...
... timestamps last received. A host operating in symmetric mode
periodically sends NTP messages to each peer including the latest
copy of the timestamps. The intervals between sending NTP ...
... NTP messages to each peer including the latest
copy of the timestamps. The intervals between sending NTP messages
are managed jointly by the host and each peer using the polling
...
... variables peer.ppoll and peer.hpoll.
When a pair of peers operating in symmetric mode exchange NTP
messages and each determines that the other is reachable, an
association ...
...
The significant events of interest in NTP occur upon expiration of
the peer timer, one of which is dedicated to each peer operating in
...
... timer, one of which is dedicated to each peer operating in
symmetric or client modes, and upon arrival of an NTP message from
the various peers. An event can also occur as the result of an
operator command or detected system fault, such as a primary clock
...
... (peer.reach) is shifted one position to the left and a zero replaces
the vacated bit. Then an NTP message is constructed and sent to the
peer. If operating in active state or in passive ...
... threshold <- max( min( peer.ppoll, peer.hpoll,
NTP.MAXPOLL), NTP.MINPOLL) .
If operating in active state ...
... the peer variables are updated as follows:
peer.hpoll <- NTP.MINPOLL
peer.disp <- NTP.MAXDISP
...
... subsequent use.
An NTP message is constructed as follows (see Appendices A and B for
formats). First, the IP and UDP ...
... pkt.dstadr <- peer.srcadr pkt.dstport <- peer.srcport
Next, the NTP packet variables are copied (rescaled as necessary)
from the system and peer variables:
...
... pkt.leap <- sys.leap pkt.distance <- sys.distance
pkt.version <- NTP.VERSION pkt.drift <- sys.drift
pkt.stratum <- sys.stratum pkt.refid <- sys.refid
...
... pkt.precision <- sys.precision
Finally, the NTP packet timestamp variables are copied, depending on
whether the peer is operating in symmetric mode and reachable, in
...
... fill these variables in the client case is that, if for some reason
the NTP message is returned by the recipient unaltered, as when
testing with an Internet-echo ...
...
The receive procedure is executed upon arrival of an NTP message. If
the version number of the message (pkt.version ...
... version) does not match the
current version number (NTP.VERSION), the message is discarded;
however, exceptions may be advised on a case-by-case basis at times
...
... pkt.leap <- sys.leap pkt.distance <- sys.distance
pkt.version <- NTP.VERSION pkt.drift <- sys.drift
pkt.stratum <- sys.stratum pkt.refid <- sys.refid
...
... correct peer. If there is a match, processing continues at the next
step below. If there is no match and symmetric mode is not indicated
(either pkt.srcport or pkt.dstport not equal to NTP.PORT), the
message must be a reply to a previously sent message from a client ...
...
If there is no match and symmetric mode is indicated, (both
pkt.srcport and pkt.dstport equal to NTP.PORT), an implementation-
specific instantiation procedure is called to create ...
... peer.hpoll <- NTP.MINPOLL
peer.disp <- NTP.MAXDISP
The remaining peer variables are undefined and set to zero ...
... register (peer.reach) is
set, indicating the peer is now reachable. The following peer
variables are copied (rescaled as necessary) from the NTP packet
variables and system variables:
...
... threshold <- max( min( peer.ppoll, peer.hpoll,
NTP.MAXPOLL), NTP.MINPOLL)
If either or both the pkt.org or pkt.rec packet variables are zero,
...
... peer are calculated as follows. Number the times of sending and
receiving NTP messages as shown in Figure 3.1 and let i be an even
integer. Then t(i-3), t(i-2) and t(i-1) and t(i) are the contents of
...
... clock filter algorithm is not an integral part of the NTP
specification; however, one found to work well in the Internet
environment is described in Section 4.
...
... Specification of the clock selection algorithm and logical clock
procedure is not an integral part of the NTP specification. A clock
selection algorithm found to work well in the Internet environment ...
... algorithms are believed
the best available at the present time, they are not an integral part
of the NTP specification.
There are two algorithms ...
... The clock filter algorithm is executed upon arrival of each NTP
message that results in new delay/offset sample pairs. New sample
...
...
The selection process operates on each peer in turn and inspects the
various data captured from the last received NTP message header, as
well as the latest clock filter ...
... set as its peer data structure pointer and the peer.hpoll variable in
that structure is set to NTP.MINPOLL as required by the logical clock
mechanism described in Section 5.
...
... this expectation, it is useful to explore variable-rate polling, in
which the intervals between NTP messages can be adjusted to fit
prevailing network conditions of delay dispersion and loss rate. The
...
... prevailing network conditions of delay dispersion and loss rate. The
prototype NTP implementation uses this technique to reduce the
network overheads ...
... update procedure, subject to a maximum of
NTP.MAXPOLL. Following the timeout procedure, if peer.reach
indicates messages have not been received for the preceding two
polling intervals (low-order two bits ...
... bits are zero), the value of
peer.hpoll is decreased by one, subject to a minimum of NTP.MINPOLL.
If peer.reach becomes zero (unreachable), the value of peer.hpoll is
set to NTP ...
... NTP.MINPOLL.
If peer.reach becomes zero (unreachable), the value of peer.hpoll is
set to NTP.MINPOLL.
The result of the above mechanism is that the polling intervals for
...
... interface and
capable of the required precision and stability. The logical clock
is adjusted by means of periodic offset corrections computed by NTP
or some other time-synchronization protocol such as Hellospeak [15 ...
... Register Size PEER.SHIFT 8 4
Host Poll Interval peer.hpoll NTP.MINPOLL NTP.MINPOLL
(64 sec) (64 sec)
...
... when a clock is selected according to the algorithms of Section 4,
the polling interval peer.hpoll is always set at NTP.MINPOLL.
...
...
Conversion from NTP format to the common date and time formats used
by application programs is simplified if the internal local-clock
format uses separate date and time registers ...
...
After an NTP message is received and until the next one is received,
the accuracy of the local clock can be expected to degrade somewhat.
The magnitude of this degradation depends on the error at the last
...
... respect to time. It is possible to estimate both the error and drift
rate from data collected during regular operation. These data can be
used to determine the rate at which NTP neighbors should exchange NTP
...
... used to determine the rate at which NTP neighbors should exchange NTP
messages and thus control net overheads.
...
... overheads.
NTP messages include the local-clock precision of the sender, as well
as the reference time, estimated drift and a quantity called the
...
... above. However, they also have indirect utility to the recipient of
an NTP message sent by that peer, since they can be used as weights
in such algorithms as described in [22 ...
... estimates during periods when offsets are not available. It is most
useful if the latest estimate of these quantities are available in
each NTP message sent; however, considerable latitude remains in the
details of computation and storage.
...
... EGP and local-net control
algorithms, peers exchange messages on the order of once or twice a
minute. If NTP peers exchanged messages at a rate of one per minute
and if T were one day, the circular buffer would have to be 1440
...
... Mills, D., "Network Time Protocol (NTP)", RFC-958(-> 1305draft | 1119(-> 1305draft) | 1059(-> 1305draft | 1119(-> 1305draft))), M/A-COM Linkabit, September 1985. ...
... NTP packet consists of the UDP header followed by the NTP data
portion. The format of the UDP header ...
... header and the interpretation of its
fields are described in [6] and are not part of the NTP
specification. They are shown below for completeness.
...
... destination port number. In the case of a client request
this field is assigned the NTP service-port number 123, while
...
... 0 unspecified
1 primary reference (e.g., radio clock)
2...n secondary reference (via NTP)
Poll
...
... TIMESTAMP protocols and the clock
offsets (in milliseconds) for each protocol averaged with respect to
local time, which is synchronized via NTP to a radio-clock host.
While the ICMP ...
... TIMESTAMP. At that
time there were no UDP/NTP implementations. There are many more
hosts and gateways ...
...
It can be seen that ten percent of the UDP/NTP responses show errors
of 11 milliseconds or less and that ten percent of the UDP/TIME
...
... responses show errors greater than 807135 milliseconds (about 13
minutes). Fifty percent of the UDP/NTP timetellers are within 364
milliseconds, while fifty percent of the UDP/TIME tellers are within
...
... algorithm was found to be more resistant to glitches and
to provide a more accurate estimate than the unmodified one. It has
been implemented in the NTP daemons developed for the Fuzzball and
Unix operating systems and been in regular operation for about two
...
... consider how offsets and delays are computed. Number the times of
sending and receiving NTP messages as shown in Figure D.1 and let i
be an even integer. Then the timestamps ...
... packet-switch hops and thus the number of
queues. Thus, not only is the probability that an arriving NTP
packet finds a busy queue in one direction reasonably low, but the
...
... determined independent of the measurement procedure itself.
The raw delays and offsets were measured by NTP from hosts at U
Maryland (UMD) and U Delaware (UDEL) via net paths to each other and
...
...
This section discusses net configuration issues for implementing a
ubiquitous NTP service in the Internet system. Section E.1 describes
...
... service in the Internet system. Section E.1 describes
the NTP primary service net now in operation, including an analysis
of failure scenarios. Section E.2 suggests how secondary service ...
...
Figure E.1 shows how the five primary servers are interconnected as
NTP peers. Note that each server actively probes two other servers
(along the direction of the arrows), which means these probes ...
... the radio clock itself becomes disabled or the propagation path to
its synchronizing source fails, then the server drops to stratum two
and synchronizes via NTP with its neighbor at the smallest
synchronizing distance. If a radio clock appears to operate
...
... correctly but delivers incorrect time (falseticker), the server may
remain synchronized to the clock. However, gross discrepancies will
become apparent via the NTP peer paths, which will ordinarily result
in an operator alarm.
...
... hosts can obtain retail time from primary or secondary
service net using NTP in client/server mode, which does not require
dedicated server resources as does symmetric mode. It is anticipated
...
... that ordinary hosts will be quite close to a secondary server,
perhaps on the same cable or local net, so that the frequency of NTP
request messages need only be high enough, perhaps one per hour or
...
