1 / 34

NTP

NTP. Network Time Protocol Nóirín Plunkett. A Short French Lesson. TAI – Temps Atomique International International Atomic Time UTC – Temps Universel Coordonné Universal Co-ordinated Time BIH – Bureau International de l’Heure International Time Bureau. Second. SI Unit

katima
Download Presentation

NTP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NTP Network Time Protocol Nóirín Plunkett

  2. A Short French Lesson • TAI – Temps Atomique International • International Atomic Time • UTC – Temps Universel Coordonné • Universal Co-ordinated Time • BIH – Bureau International de l’Heure • International Time Bureau

  3. Second • SI Unit • 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium-133 atom

  4. Brief History of Time • Second defined in 1967 • UTC started on 1st January 1972 • RFC 778, 1981 - Internet Clock Service • RFC 958, 1985 - description of NTP • RFC 1059, 1988 - NTPv1, protocol & algorithms • RFC 1305, 1992 - NTPv3, formal correctness principles • NTPv4 in use, not yet formalised

  5. Real World • “Time is what prevents everything from happening at once.” - J.A. Wheeler • Correlating logs of events • Cryptographic expiries • Air Traffic Control • GPS • Networking

  6. Atomic Time • 260 atomic clocks in 40 labs contribute to the international time standards contribute to TAI • Radio broadcasts • DCF77, Physikalisch-Technische Bundesanstalt, Braunschweig (77.5kHz) • GPS based on US Naval Observatory, DC

  7. NTP and UTC • NTP is based on UTC • NTP has no memory • Every leap-second, NTP ‘resets’ itself to the current UTC value • Using a clock synchronised to UTC in 2005 to calculate the time of an event in early 1972 would result in 22 seconds difference

  8. What NTP Does • Provide most accurate time possible, based on ‘reference time’ - not just syncing to a common time • Keep in sync with leap seconds • Ignore ‘falsetickers’ - clocks it could use for reference, but which provide an apparently wrong time • Use previous figures to estimate current difference between system time and reference time, in the absence of a network connection

  9. What NTP Does Not • Convert NTP timestamps into system time format • Set the hardware clock • Handle time-zones/summer time • Recognise when the system clock is far off and accept apparent ‘falsetickers’ as true

  10. Some Definitions • Reference clock - a device which gives a known accurate time • Accuracy - the difference between the value of a measurement and the actual measurand • Precision - how close two measurements of the same value are

  11. Precision vs Accuracy • Exp I - Imprecise, inaccurate • Exp II - Imprecise, accurate • Exp III - Precise, inaccurate • Exp IV - Precise, accurate (image source)

  12. NTP Packet • UDP Packet • Request • Time of client system clock at sending • Response • Time of client system clock at sending • Time of receipt at server • Time of server system clock at sending

  13. NTP Timestamp • 64-bit number • First 32 bits represent seconds since 00:00, January 1st, 1900 • Next 32 bits represent fractions of a second • Sat, Nov 19 2005 19:27:30.869 • c729fb22.de8afc9d • 11000111 00101001 11111011 00100010 . 11011110 10001010 11111100 10011101

  14. More Definitions • Latency - the time taken for a packet to reach its destination • Round trip time - the time taken between the client sending out a packet, and receiving a response to that packet from the server • Jitter - variability of latency over time

  15. Timestamps in Packets • Client sends packet - T1 • Server receives packet, adds receipt timestamp - T2 • Server prepares packet to send to client, adds sending timestamp - T3 • Client receives packet - T4 • Latency client -> server = (T2-T1) • Latency server -> client = (T4-T3)

  16. Round Trip Times • Actual RTT = (T4-T1) • Network RTT = (T2-T1) + (T4-T3) • Latencies = (T2-T1), (T4-T3) • If latencies are symmetric (within reason), (T1+T4) = (T2+T3) • If (T1+T4) != (T2+T3), our estimate of clock offset is (T1+T4) - (T2+T3)

  17. Truechimers & Falsetickers • Multiple servers providing time estimates • If the majority of servers provide a consistent time - they’re probably right • If there are one or two outliers - they’re probably wrong

  18. Peering • Client should peer with multiple servers (image source)

  19. Law of Averages • Peering with multiple servers makes for more reliable results • Falsetickers will be easier to identify • Truechimers will be more useful (because more servers means we can dismiss borderline true/false) • Assumptions become statistically more reliable • Latency symmetry • Clock regularity

  20. Problems with Peering • Loops • NTP prevents loops, through spanning-tree mechanism • Layers • NTP prevents there being more than fourteen layers, by using strata

  21. Strata • Radio clock - Stratum 0 • Computer running NTP syncing from radio clock - Stratum 1 • Computer syncing from Stratum n NTP server - Stratum n+1 • Server unreachable - Stratum 16

  22. Lies, Damn Lies • NTP checks that values are consistent with previous measurements • Deals with sudden changes in network/system load • Allows NTP to ‘guess’, in case of network failure • If values are very different from previously, but remain consistent, NTP accepts that local clock may be falseticker

  23. Clocks • Hardware clock - quartz crystal • Software clock - interrupt-driven timer chips • Software clock more accurate for judging interval between two times • Both need to be set to correct time

  24. Problems • Inaccurate time needs to be corrected • Massive time changes are undesirable • Time travel is undesirable • Skipping seconds is bad • Going backwards is not allowed • Best way of balancing all this is to slow down/speed up time • This only works with computers, and in the movies!

  25. Exceptions • On system boot-up, time can be set, regardless of offset from previous time • init scripts are aware of this, bootup expects it, nothing should break • Computers do what they’re told - regardless of what the admin intended • If an admin tells the system to update its time, it updates. Things may break.

  26. Phase Lock Loops • Raises (or lowers) frequency of an oscillator until it matches a reference frequency • Pauses oscillator as necessary to match ref. phase

  27. More on PLL • Seconds can be speeded up or slowed down, until they happen as often as reference clock - frequency is matched • NTP can also use this speed change to match the phase - some PLLs will stop the oscillator momentarily to do this

  28. NTP Traffic • ntp.maths.tcd.ie • Stratum 1 server, syncing from radio clock

  29. Daily Peak • Graph dates from IST - blip occurring at 1am local time

  30. After IST Ends • Peak remains - still at midnight GMT

  31. Daylight Savings Time • NTP is time-zone agnostic

  32. Daylight Savings Time Ends • 2005-W43-7 - Daylight Savings Time ends

  33. Strange Happenings

  34. References • RFC 1305 • http://www.ntp.isc.org • http://www.eecis.udel.edu/~mills/ • ntp.maths.tcd.ie

More Related