NTP Architecture, Protocol and Algorithms: David L. Mills University of Delaware Mills@udel - Edu
NTP Architecture, Protocol and Algorithms: David L. Mills University of Delaware Mills@udel - Edu
NTP Architecture, Protocol and Algorithms: David L. Mills University of Delaware Mills@udel - Edu
10-Jan-03
NTP synchronizes the clocks of hosts and routers in the Internet Time synchronization flows from primary servers synchronized via radio and satellite over hierarchical subnet to other servers and clients NTP provides submillisecond accuracy on LANs, low tens of milliseconds on typical WANs spanning the country NTP software daemon has been ported to almost every workstation and server platform available today, including Unix, Windows and VMS Well over 100,000 NTP clients and servers are now deployed in the Internet and its tributaries all over the world
10-Jan-03 2
NTP Messages
Multiple servers/peers provide redundancy and diversity Clock filters select best from a window of eight clock offset samples Intersection and clustering algorithms pick best subset of peers and discard outlyers Combining algorithm computes weighted average of offsets for best accuracy Loop filter and local clock oscillator (LCO) implement hybrid phase/frequency-lock (P/F) feedback loop to minimize jitter and wander
10-Jan-03 3
Offset = 1 [( T 2 T1 ) + ( T 3 T 4 )] 2
Delay = ( T 4 T1 ) ( T3 T2 )
Most accurate clock offset is measured at the lowest delay (apex of the wedge diagram) Phase dispersion r is weighted average of offset differences over last eight samples - used as error estimator Frequency disperion f represents clock reading and frequency tolerance errors - used in distance metric Synchronization distance = f + /2 - used as distance metric and maximum error bound, since correct time 0 must be in the range 0 +
10-Jan-03 4
Intersection algorithm
B A D C Correct DTS Correct NTP correctness interval = 0 + m = number of clocks f = number of presumed falsetickers A, B, C are truechimers D is falseticker
DTS correctness interval is the intersection which contains points from the largest number of correctness intervals NTP algorithm requires the midpoint of the intervals to be in the intersection
Initially, set falsetickers f and counters c and d to zero Scan from far left endpoint: add one to c for every lower endpoint, subtract one for every upper endpoint, add one to d for every midpoint If c m f and d m f, declare success and exit procedure Do the same starting from the far right endpoint If success undeclared, increase f by one and try all over again if f m/2, declare failure
10-Jan-03 5
Vd is a function of the phase difference between NTP and LCO Vs depends on the stage chosen on the clock filter shift register x and y are the phase update and frequency update, respectively, computed by the prediction functions Clock adjust process runs once per second to compute Vc, which controls the frequency of the local clock oscillator LCO phase is compared to NTP phase to close the feedback loop
10-Jan-03 6
10-Jan-03
Implementation issues
Public-key cryptography
Encryption/decryption algorithms are relatively slow with highly variable running times depending on key and data All keys are random; private keys are never divulged Certificate scheme reliably binds server identification and public key Well suited to multicast paradigm
Symmetric-key cryptography
Encryption/decryption algorithms are relatively fast with constant running times independent of key and data Fixed private keys must be distributed in advance Key agreement (Diffie-Hellman) is required for private random keys Per-association state must be maintained for all clients Not well suited to multicast paradigm
10-Jan-03
150
100
50
0 HP 9000/735 SPARC20 Alpha 3000/600 Alpha 3000/400 SPARC IPC DEC 5000/240 SPARC1+
Measured times to construct 128-bit hash of 48-octet NTP header using MD5 algortihm in RSAREF
10-Jan-03
10
2.0
Time (s)
1.5
Max Avg
1.0
0.5
0.0
13 Pe 3 nt iu m Al 13 ph a 3 30 00 /6 H 00 P 90 00 /7 SP 35 AR C 10 D /7 EC 1 50 00 /2 40 SP AR C SP 2 AR C IP SP X AR C IP C SP AR C 1+ SP AR C 1 4/ 26 25 Al ph a 046 00 6
Measured times (s) to construct digital signature using RSAREF Message authentication code constructed from 48-octet NTP header hashed with MD5, then encrypted with RSA 512-bit private key
10-Jan-03 11
SG
IR
Field types
Null/padding - for testing, etc. Certificate - as obtained from directory services (optional) Autokey - in the above format Others as necessary
10-Jan-03 13
Server Key
Server rolls a random 32-bit seed as the initial key ID Server generates each session key as hash of IP addresses and key ID Low order 32 bits of the session key become the key ID for the next session key Server encrypts the last key using RSA and its private key to produce the server key Server uses the session key list in reverse order and generates a new one when exhausted
10-Jan-03 14
10-Jan-03
15
Non-goals
Administrative restrictions (multicast group membership control) Access control - this is provided by firewalls and address filtering Privacy - all protocol values, including time values, are public Protection against out of order or duplicated messages - this is provided by the NTP protocol Non-repudiation - this can be provided by a layered protocol if necessary
10-Jan-03
16
10-Jan-03
19
10-Jan-03
21
Nanokernel architecture
Frequency Variable Clock Oscillator Calculate Increment Phase Variable PPS Discipline PPS Interrupt Update NTP
Tick Interrupt
Second Overflow
NTP updates adjust phase and frequency according to time constant at intervals from 64 s to over one day On overflow of the clock second, a new increment is calculated for the tick adjustment Adjustment is added to system clock at every tick interrupt Auxiliary oscillator used to interpret microseconds or nanoseconds between tick interrupts PPS discipline adjusts phase at 64-s intervals, frequency at 256-s intervals
10-Jan-03 22
SCO Vc
Type II, adaptive-parameter, hybrid phase/frequency-lock loop estimates system clock oscillator (SCO) phase and frequency NTP daemon computes phase error Vd = r o between source and SCO, then grooms samples to produce control signal Vc Loop filter computes phase and frequency updates and provides tick adjustments Vc SCO adjusted at each hardware tick interrupt
10-Jan-03
23
Vs is the phase offset produced by the data grooming algorithms x is the phase correction computed as a fraction of Vs yFLL is the frequency adjustment computed as the average of past frequency offsets yPLL is the frequency adjustment computed as the integral of past phase offsets yFLL and yPLL are combined according to weight factors computed from update interval and Allan deviation predictor
10-Jan-03 24
Phase and frequency disciplined separately - phase from system clock second offset, frequency from process cycle counter (PCC) Frequency discriminator rejects noise and misconfigured connections Median filter rejects sample outlyers and provides error statistic Nonlinear range check filters reject burst errors in phase and frequency Phase offsets integrated over 64-s interval Frequency offsets integrated over 256-s interval
10-Jan-03
25
Graph shows jitter with PPS signal from GPS receiver Principal error contribution is due to long unterminated signal cable
10-Jan-03
26
Inexpensive second-generation bus peripheral for IBM 386-class PC with oven-stabilized external master clock oscillator
Includes 100-kHz analog receiver with D/A and A/D converters Functions as precision oscillator with frequency disciplined to selected LORAN-C chain within 200 ns of UTC(LORAN) and 10-10 stability PC control program (in portable C) simultaneously tracks up to six stations from the same LORAN-C chain
10-Jan-03
29
Future plans
Complete autoconfigure and autokey implementation in NTP Version 4 Deploy, test and evaluate NTP Version 4 daemon in DARTnet II testbed, then at friendly sites in the US, Europe and Asia Revise the NTP formal specification and launch on standards track Participate in deployment strategies with NIST, USNO, others Prosecute standards agendae in IETF, ANSI, ITU, POSIX Develop scenarios for other applications such as web caching, DNS servers and other multicast services
10-Jan-03
30
Further information
Network Time Protocol (NTP): www.eecis.udel.edu/~ntp
Current NTP Version 3 and 4 software and documentation FAQ and links to other sources and interesting places