8
Second Edition COMPUTER NETWORK TIME SYNCHRONIZATION The Network Time Protocol on Earth and in Space David L. Mills Up) CRC Press \V J Taylor &. Francis Group Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Group, an informa business

COMPUTER NETWORK TIME SYNCHRONIZATION

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: COMPUTER NETWORK TIME SYNCHRONIZATION

Second Edition

COMPUTER NETWORK TIME SYNCHRONIZATION The Network Time Protocol on Earth and in Space

David L. Mills

Up) CRC Press \ V J Taylor &. Francis Group

Boca Raton London New York

CRC Press is an imprint of the Taylor & Francis Group, an informa business

Page 2: COMPUTER NETWORK TIME SYNCHRONIZATION

Contents

List of Illustrations xv List of Tables xxi Preface xxiii About the Author xxvii

1 Basic Concepts 1 1.1 Time Synchronization 1 1.2 Time Synchronization Protocols 3 1.3 Computer Clocks 5 1.4 Processing Time Values 7 1.5 Correctness and Accuracy Expectations 8 1.6 Security 10 1.7 NTP in the Internet 12 1.8 Parting Shots 13 References 14 Further Reading 14

2 How NTP Works 15 2.1 General Infrastructure Requirements 16 2.2 How NTP Represents the Time 17 2.3 How NTP Reckons the Time 19 2.4 How NTP Disciplines the Time 21 2.5 How NTP Manages Associations 22 2.6 How NTP Discovers Servers 25 2.7 How NTP Deals with Stale Time Values 26 2.8 How NTP Manages Network Resources 27 2.9 How NTP Avoids Errors 28 2.10 How NTP Performance Is Determined 30 2.11 How NTP Controls Access 31 2.12 How NTP Watches for Terrorists 32 2.13 How NTP Clocks Are Watched 33 2.14 Parting Shots 34 References 35 Further Reading 35

3 In the Belly of the Beast 37 3.1 Related Technology 37 3.2 Terms and Notation 40 3.3 Process Flow 41

Vll

Page 3: COMPUTER NETWORK TIME SYNCHRONIZATION

viii Contents

3.4 Peer Process 43 3.5 Poll Process 44 3.6 On-Wire Protocol 46 3.7 Clock Filter Algorithm 48 3.8 Select Algorithm 51 3.9 Cluster Algorithm 56 3.10 Combine Algorithm 59 3.11 Mitigation Rules and the Prefer Peer 60

3.11.1 The Prefer Peer 61 3.11.2 Peer Classification 61 3.11.3 Mitigation Rules 62 3.11.4 The minsane Option 63

3.12 Huff-'n-Puff Filter 64 3.13 Orphan Mode 65 3.14 Rate Control and the Kiss-o'-Death Packet 67

3.14.1 Average Headway and Guard Time 68 3.14.2 The Kiss-o'-Death Packet 69

3.15 Parting Shots 70 References 70 Further Reading 72

4 Clock Discipline Algorithm 73 4.1 Feedback Control Systems 74 4.2 Phase and Frequency Discipline 76 4.3 Time and Frequency Response 78 4.4 Poll Interval Control 81 4.5 Popcorn and Step Control 82 4.6 Clock State Machine 84 4.7 Parting Shots 86 References 87 Further Reading 87

5 NTP System Engineering and Configuration 89 5.1 Core Engineering Principles 90 5.2 Engineering Large Corporate and Campus NTP Systems 92 5.3 Examples of Large Corporate NTP Systems 93 5.4 Engineering Home Office and Small Business NTP Systems 96 5.5 Network Considerations 97 5.6 General Configuration Considerations 98 5.7 Manual Server Discovery 100 5.8 Automatic Server Discovery 101

5.8.1 Broadcast/Multicast Discovery 102 5.8.2 NTP Manycast Discovery 103 5.8.3 NTP Pool Discovery 103

Page 4: COMPUTER NETWORK TIME SYNCHRONIZATION

Contents ix

5.9 Configuration Commands and Options 105 5.9.1 Association Configuration Options ( se rve r , peer ,

and the Like) 105 5.9.2 Type of Service Options (tos) 107 5.9.3 Tinker Options ( t i n k e r ) 109

5.10 Parting Shots 110 Further Reading 110

6 NTP Performance in the Internet I l l 6.1 Performance Measurement Tools 112 6.2 System Clock Latency Characteristics 113 6.3 Characteristics of a Primary Server and Reference Clock 114 6.4 Characteristics between Primary Servers on the Internet 117 6.5 Characteristics of a Client and a Primary Server on a

Fast Ethernet 123 6.6 Results from an Internet Survey 125 6.7 Server and Network Resource Requirements 128 6.8 Parting Shots 130 References 130

7 Primary Servers and Reference Clocks 131 7.1 Driver Structure and Interface 132 7.2 Serial Timecode Drivers 135 7.3 Generic Modem Driver 137 7.4 Local Clock Driver 138 7.5 PPS Interface and Driver 139 7.6 Audio Drivers 140

7.6.1 IRIG Driver 142 7.6.2 WWV/H Driver 142 7.6.3 CHU Driver 145

References 147

8 Kernel Timekeeping Support 149 8.1 System Clock Reading Algorithm 151 8.2 Kernel Discipline Algorithms 153 8.3 Kernel PLL/FLL Discipline 155 8.4 Kernel PPS Discipline 156 8.5 Clock Adjust Algorithm 158 8.6 Proof of Performance 159 8.7 Kernel PLL/FLL Discipline Performance 160 8.8 Kernel PPS Discipline 165 8.9 Parting Shots 168 References 168 Further Reading 168

Page 5: COMPUTER NETWORK TIME SYNCHRONIZATION

x Contents

9 Cryptographic Authentication 169 9.1 NTP Security Model 170

9.1.1 On the Provenance of Filestamps 172 9.1.2 On the Naming of Things 173 9.1.3 On Threats and Countermeasures 173

9.2 NTP Secure Groups 175 9.3 Autokey Security Protocol 178

9.3.1 Session Key Operations 179 9.3.2 X509 Certificates 181 9.3.3 Protocol Operations 182

9.4 Parting Shots 183 References 183 Further Reading 184

10 Identity Schemes 185 10.1 Identity Schemes 186

10.1.1 Private Certificate Identity Scheme 187 10.1.2 Trusted Certificate Identity Scheme 188 10.1.3 Schnorr Identity Scheme 188 10.1.4 Guillou-Quisquater Identity Scheme 190 10.1.5 Mu-Varadharajan Identity Scheme 192

10.2 Cryptotypes 195 10.3 Parting Shots 198 References 198 Further Reading 198

11 Analysis of Errors 199 11.1 Clock Reading Errors 200 11.2 Timestamp Errors 201 11.3 Sawtooth Errors 203 11.4 Peer Error Budget 204 11.5 System Error Budget 206 11.6 Parting Shots 208 References 208

12 Modeling and Analysis of Computer Clocks 209 12.1 Computer Clock Concepts 210 12.2 Mathematical Model of the Generic Feedback Loop 214

12.2.1 Type IFLL Feedback Control Loop 216 12.2.2 Type II Feedback Control Loop 217

12.3 Synthetic Timescales and Clock Wranglers 219 12.4 Parting Shots 222 References 222 Further Reading 223

Page 6: COMPUTER NETWORK TIME SYNCHRONIZATION

Contents xi

13 Metrology and Chronometry of the NTP Timescale 225 13.1 Scientific Timescales Based on Astronomy and

Atomic Physics 227 13.2 UTC and the Leap Second 229 13.3 The Leap Second Controversy 230 13.4 How NTP Reckons with UTC Leap Seconds 233 13.5 On Numbering the Calendars and Days 235 13.6 On the Julian Day Number System 237 13.7 On Timescales and the Age of Eras 238 13.8 On NTP Era and Timestamp Calculations 240 13.9 Comparison with Other Computer Timescales 241 13.10 Primary Frequency and Time Standards 243 13.11 Time and Frequency Coordination 244 13.12 Time and Frequency Dissemination 245

13.12.1 Shortwave Radio Services 246 13.12.2 Long-Wave Radio Services 246 13.12.3 Geosynchronous Operational Environmental

Satellite Service 247 13.12.4 Telephone Modem Services 248 13.12.5 Global Positioning System 248 13.12.6 LORAN-C Radio Navigation System 249

13.13 Parting Shots 252 References 253 Further Reading 254

14 NTP Reference Implementation 255 14.1 NTP Packet Header 256 14.2 Control Flow 259 14.3 Main Program and Common Routines 263 14.4 Peer Process 264 14.5 System Process 268 14.6 Clock Discipline Process 272 14.7 Clock Adjust Process 275 14.8 Poll Process 276 14.9 Parting Shots 277 References 279 Further Reading 279

15 Precision System Clock Architecture 281 15.1 Limitations of the Art 281 15.2 Precision System Clock 282

15.2.1 Timer Oscillator 283 15.2.2 Timestamp Counter 283 15.2.3 Real-Time Clock 284

Page 7: COMPUTER NETWORK TIME SYNCHRONIZATION

хп Contents

15.2.4 Precision System Clock Implementation 285 15.2.5 Precision System Clock Operations 287

15.3 Principles of Precision Timestamping 289 15.3.1 Timestamp Transposition 291 15.3.2 Error Analysis 293

15.3.2.1 Reciprocity Errors 294 15.3.2.2 Transposition Errors 295 15.3.2.3 Interworking Errors 295 15.3.2.4 Store-and-Forward Errors 296 15.3.2.5 Nonreciprocal Rate Errors 297

15.4 IEEE 1588 Precision Time Protocol 298 15.4.1 Timestamp Capture 298 15.4.2 PTP Clock Architecture 300 15.4.3 PTP Messages 301 15.4.4 Best Master Clock Algorithm 302 15.4.5 Data Set Comparison Algorithm 303 15.4.6 PTP Time Transfer 304 15.4.7 PTP and NTP Compared 305

15.5 Have Quick, STANAG 4330, and Precise Time and Time Interval Have Quick Interfaces 307

15.6 Parting Shots 309 References 309

16 NTP Interleaved Modes 311 16.1 Basic/Interleaved Protocol State Machines and Flowcharts 312 16.2 Basic Symmetric Mode 315 16.3 Interleaved Symmetric Mode 317 16.4 Interleaved Broadcast Mode 319 16.5 Error Detection and Recovery 322 16.6 Measured Performance with the Interleaved Modes 323 16.7 Parting Shots 327

17 Time Transfer for Space Data Links 329 17.1 Orbit Mechanics 330 17.2 Clock Comparisons and the Effects of General Relativity 333 17.3 Time Transfer from a Planet to the Solar System Barycenter 338 17.4 Time Comparisons between Clocks in Space 339 17.5 Spacecraft Electronics 342 17.6 Proximity-1 Protocol 345 17.7 Proximity-1 Time Service 346 17.8 Time Transfer Using the Electra Transceiver 347 17.9 Parting Shots 349 References 351 Further Reading 352

Page 8: COMPUTER NETWORK TIME SYNCHRONIZATION

Contents xiii

18 Time Transfer for Deep-Space Missions 353 18.1 Time Transfer between Earth Stations 354 18.2 Time Transfer to Earth Satellites 357 18.3 Time Transfer to the Moon and Satellites of Other Planets 359 18.4 Time Transfer for a Planetary Space Fleet 361 18.5 Time Transfer for Deep-Space Missions 367 18.6 Parting Shots 372 References 375

19 Technical History of NTP 377 19.1 On the Antiquity of NTP 378 19.2 On the Proliferation of NTP around the Globe 381 19.3 Autonomous Authentication 381 19.4 Autonomous Configuration 383 19.5 Radios, We Have Radios 384 19.6 Hunting the Nanoseconds 385 19.7 Experimental Studies 388 19.8 Theory and Algorithms 389 19.9 Growing Pains 391 19.10 As Time Goes By 391 19.11 Parting Shots 392 References 393 Further Reading 396

Bibliography 397 Acronyms 407 Index 411