📄 rfc1305.txt
字号:
F.6. Clock-Combining Procedure 84G. Appendix G. Computer Clock Modelling and Analysis 86G.1. Computer Clock Models 86G.1.1. The Fuzzball Clock Model 88G.1.2. The Unix Clock Model 89G.2. Mathematical Model of the NTP Logical Clock 91G.3. Parameter Management 93G.4. Adjusting VCO Gain (<$Ebold alpha>) 94G.5. Adjusting PLL Bandwidth (<$Ebold tau>) 94G.6. The NTP Clock Model 95H. Appendix H. Analysis of Errors and Correctness Principles98H.1. Introduction 98H.2. Timestamp Errors 98H.3. Measurement Errors 100H.4. Network Errors 101H.5. Inherited Errors 102H.6. Correctness Principles 104I. Appendix I. Selected C-Language Program Listings 107I.1. Common Definitions and Variables 107I.2. Clock<196>Filter Algorithm 108I.3. Interval Intersection Algorithm 109I.4. Clock<196>Selection Algorithm 110I.5. Clock<196>Combining Procedure 111I.6. Subroutine to Compute Synchronization Distance 112List of FiguresFigure 1. Implementation Model 6Figure 2. Calculating Delay and Offset 25Figure 3. Clock Registers 39Figure 4. NTP Message Header 50Figure 5. NTP Control Message Header 54Figure 6. Status Word Formats 55Figure 7. Authenticator Format 63Figure 8. Comparison of UTC and NTP Timescales at Leap 79Figure 9. Network Time Protocol 80Figure 10. Hardware Clock Models 86Figure 11. Clock Adjustment Process 90Figure 12. NTP Phase-Lock Loop (PLL) Model 91Figure 13. Timing Intervals 96Figure 14. Measuring Delay and Offset 100Figure 15. Error Accumulations 103Figure 16. Confidence Intervals and Intersections 105List of TablesTable 1. System Variables 12Table 2. Peer Variables 13Table 3. Packet Variables 14Table 4. Parameters 16Table 5. Modes and Actions 22Table 6. Clock Parameters 40Table 7. Characteristics of Standard Oscillators 71Table 8. Table of Leap-Second Insertions 77Table 9. Notation Used in PLL Analysis 91Table 10. PLL Parameters 91Table 11. Notation Used in PLL Analysis 95Table 12. Notation Used in Error Analysis 98IntroductionThis document constitutes a formal specification of the Network TimeProtocol (NTP) Version 3, which is used to synchronize timekeeping amonga set of distributed time servers and clients. It defines thearchitectures, algorithms, entities and protocols used by NTP and isintended primarily for implementors. A companion document [MIL91a]summarizes the requirements, analytical models, algorithmic analysis andperformance under typical Internet conditions. Another document [MIL91b]describes the NTP timescale and its relationship to other standardtimescales now in use. NTP was first described in RFC-958 [MIL85c], buthas since evolved in significant ways, culminating in the most recentNTP Version 2 described in RFC-1119 [MIL89]. It is built on the InternetProtocol (IP) [DAR81a] and User Datagram Protocol (UDP) [POS80], whichprovide a connectionless transport mechanism; however, it is readilyadaptable to other protocol suites. NTP is evolved from the TimeProtocol [POS83b] and the ICMP Timestamp message [DAR81b], but isspecifically designed to maintain accuracy and robustness, even whenused over typical Internet paths involving multiple gateways, highlydispersive delays and unreliable nets.The service environment consists of the implementation model and servicemodel described in Section 2. The implementation model is based on amultiple-process operating system architecture, although otherarchitectures could be used as well. The service model is based on areturnable-time design which depends only on measured clock offsets, butdoes not require reliable message delivery. The synchronization subnetuses a self-organizing, hierarchical-master-slave configuration, withsynchronization paths determined by a minimum-weight spanning tree.While multiple masters (primary servers) may exist, there is norequirement for an election protocol.NTP itself is described in Section 3. It provides the protocolmechanisms to synchronize time in principle to precisions in the orderof nanoseconds while preserving a non-ambiguous date well into the nextcentury. The protocol includes provisions to specify the characteristicsand estimate the error of the local clock and the time server to whichit may be synchronized. It also includes provisions for operation with anumber of mutually suspicious, hierarchically distributed primaryreference sources such as radio-synchronized clocks.Section 4 describes algorithms useful for deglitching and smoothingclock-offset samples collected on a continuous basis. These algorithmsevolved from those suggested in [MIL85a], were refined as the results ofexperiments described in [MIL85b] and further evolved under typicaloperating conditions over the last three years. In addition, as theresult of experience in operating multiple-server subnets includingradio clocks at several sites in the U.S. and with clients in the U.S.and Europe, reliable algorithms for selecting good clocks from apopulation possibly including broken ones have been developed [DEC89],[MIL91a] and are described in Section 4.The accuracies achievable by NTP depend strongly on the precision of thelocal-clock hardware and stringent control of device and processlatencies. Provisions must be included to adjust the software logical-clock time and frequency in response to corrections produced by NTP.Section 5 describes a local-clock design evolved from the Fuzzballimplementation described in [MIL83b] and [MIL88b]. This design includesoffset-slewing, frequency compensation and deglitching mechanismscapable of accuracies in the order of a millisecond, even after extendedperiods when synchronization to primary reference sources has been lost.Details specific to NTP packet formats used with the Internet Protocol(IP) and User Datagram Protocol (UDP) are presented in Appendix A, whiledetails of a suggested auxiliary NTP Control Message, which may be usedwhen comprehensive network-monitoring facilities are not available, arepresented in Appendix B. Appendix C contains specification andimplementation details of an optional authentication mechanism which canbe used to control access and prevent unauthorized data modification,while Appendix D contains a listing of differences between Version 3 ofNTP and previous versions. Appendix E expands on issues involved withprecision timescales and calendar dating peculiar to computer networksand NTP. Appendix F describes an optional algorithm to improve accuracyby combining the time offsets of a number of clocks. Appendix G presentsa detailed mathematical model and analysis of the NTP local-clockalgorithms. Appendix H analyzes the sources and propagation of errorsand presents correctness principles relating to the time-transferservice. Appendix I illustrates C-language code segments for the clock-filter, clock-selection and related algorithms described in Section 4.Related TechnologyOther mechanisms have been specified in the Internet protocol suite torecord and transmit the time at which an event takes place, includingthe Daytime protocol [POS83a], Time Protocol [POS83b], ICMP Timestampmessage [DAR81b] and IP Timestamp option [SU81]. Experimental results onmeasured clock offsets and roundtrip delays in the Internet arediscussed in [MIL83a], [MIL85b], [COL88] and [MIL88a]. Othersynchronization algorithms are discussed in [LAM78], [GUS84], [HAL84],[LUN84], [LAM85], [MAR85], [MIL85a], [MIL85b], [MIL85c], [GUS85b],[SCH86], [TRI86], [RIC88], [MIL88a], [DEC89] and [MIL91a], whileprotocols based on them are described in [MIL81a], [MIL81b], [MIL83b],[GUS85a], [MIL85c], [TRI86], [MIL88a], [DEC89] and [MIL91a]. NTP usestechniques evolved from them and both linear-systems and agreementmethodologies. Linear methods for digital telephone networksynchronization are summarized in [LIN80], while agreement methods forclock synchronization are summarized in [LAM85].The Digital Time Service (DTS) [DEC89] has many of the same serviceobjectives as NTP. The DTS design places heavy emphasis on configurationmanagement and correctness principles when operated in a managed LAN orLAN-cluster environment, while NTP places heavy emphasis on the accuracyand stability of the service operated in an unmanaged, global-internetenvironment. In DTS a synchronization subnet consists of clerks,servers, couriers and time providers. With respect to the NTPnomenclature, a time provider is a primary reference source, a courieris a secondary server intended to import time from one or more distantprimary servers for local redistribution and a server is intended toprovide time for possibly many end nodes or clerks. Unlike NTP, DTS doesnot need or use mode or stratum information in clock selection and doesnot include provisions to filter timing noise, select the most accuratefrom a set of presumed correct clocks or compensate for inherentfrequency errors.In fact, the latest revisions in NTP have adopted certain features ofDTS in order to support correctness principles. These include mechanismsto bound the maximum errors inherent in the time-transfer procedures andthe use of a provably correct (subject to stated assumptions) mechanismto reject inappropriate peers in the clock-selection procedures. Thesefeatures are described in Section 4 and Appendix H of this document.The Fuzzball routing protocol [MIL83b], sometimes called Hellospeak,incorporates time synchronization directly into the routing-protocoldesign. One or more processes synchronize to an external referencesource, such as a radio clock or NTP daemon, and the routing algorithmconstructs a minimum-weight spanning tree rooted on these processes. Theclock offsets are then distributed along the arcs of the spanning treeto all processes in the system and the various process clocks correctedusing the procedure described in Section 5 of this document. While itcan be seen that the design of Hellospeak strongly influenced the designof NTP, Hellospeak itself is not an Internet protocol and is unsuitedfor use outside its local-net environment.The Unix 4.3bsd time daemon timed [GUS85a] uses a single master-timedaemon to measure offsets of a number of slave hosts and send periodiccorrections to them. In this model the master is determined using anelection algorithm [GUS85b] designed to avoid situations where either nomaster is elected or more than one master is elected. The electionprocess requires a broadcast capability, which is not a ubiquitousfeature of the Internet. While this model has been extended to supporthierarchical configurations in which a slave on one network serves as amaster on the other [TRI86], the model requires handcraftedconfiguration tables in order to establish the hierarchy and avoidloops. In addition to the burdensome, but presumably infrequent,overheads of the election process, the offset measurement/correctionprocess requires twice as many messages as NTP per update.A scheme with features similar to NTP is described in [KOP87]. Thisscheme is intended for multi-server LANs where each of a set of possiblymany time servers determines its local-time offset relative to each ofthe other servers in the set using periodic timestamped messages, thendetermines the local-clock correction using the Fault-Tolerant Average(FTA) algorithm of [LUN84]. The FTA algorithm, which is useful where upto k servers may be faulty, sorts the offsets, discards the k highestand lowest ones and averages the rest. The scheme, as described in[SCH86], is most suitable to LAN environments which support broadcastand would result in unacceptable overhead in an internet environment. Inaddition, for reasons given in Section 4 of this paper, the statisticalproperties of the FTA algorithm are not likely to be optimal in aninternet environment with highly dispersive delays.A good deal of research has gone into the issue of maintaining accuratetime in a community where some clocks cannot be trusted. A truechimer isa clock that maintains timekeeping accuracy to a previously published(and trusted) standard, while a falseticker is a clock that does not.Determining whether a particular clock is a truechimer or falseticker isan interesting abstract problem which can be attacked using agreementmethods summarized in [LAM85] and [SRI87].A convergence function operates upon the offsets between the clocks in asystem to increase the accuracy by reducing or eliminating errors causedby falsetickers. There are two classes of convergence functions, thoseinvolving interactive-convergence algorithms and those involvinginteractive-consistency algorithms. Interactive-convergence algorithms
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -