Understanding and using the Network Time Protocol (A first try on a non-technical Mini-HOWTO and FAQ on NTP)

Last update: 2006-11-21

Table of Contents

  1. About this Document
    1.1 Preface
    1.2 Why is this Document named FAQ and HOWTO?
    1.3 Where is the source of this document?
    1.4 Why can’t I find information about xyz in this FAQ?
    1.5 Where should a new Entry be put?
    1.6 Why should I contribute?
    1.7 How can I contribute?
    1.8 I contributed to this FAQ, but my name is not mentioned anywhere. What’s wrong?
    1.9 Why are Graphics stored in PNG Format?
    1.10 Credits

  2. Time, what Time?
    2.1 What is Time?
    2.2 What is UTC?
    2.3 Is UTC the same as GMT?
    2.4 What happens during a Leap Second?

  3. How do Computer Clocks work?
    3.1 Bits and Registers
    3.2 Making Time go on
    3.3 Clock Quality
    3.3.1 Frequency Error How bad is a Frequency Error of 500 PPM? What is the Frequency Error of a good Clock?

  4. What is NTP?
    4.1 Overview
    4.1.1 What is NTP?
    4.1.2 What is SNTP?
    4.1.3 Why should Time be synchronized?
    4.1.4 What are the basic features of NTP?
    4.1.5 Which Operating Systems are supported?
    4.1.6 How many NTP servers are available in the Internet?
    4.1.7 Which version of NTP should I use?
    4.1.8 What’s the difference between xntp and ntp?
    4.2. History
    4.3. Implementations and Platforms
    4.3.1 Official Providers
    4.3.2 UNIX Systems
    4.3.3 Microsoft Windows

  5. How does it work?
    5.1 Basic Concepts
    5.1.1 Time References What is a reference clock? How will NTP use a reference clock? How will NTP know about Time Sources? What happens if the Reference Time changes? What is a stratum 1 Server?
    5.1.2 Time Exchange How is Time synchronized? Which Network Protocols are used by NTP? How is Time encoded in NTP? When are the Servers polled?
    5.1.3 Performance How accurate will my Clock be? How frequently will the System Clock be updated? How frequently are Correction Values updated? What is the Limit for the Number of Clients?
    5.1.4 Robustness What is the stratum? How are Synchronization Loops avoided?
    5.1.5 Tuning What is the allowed range for minpoll and maxpoll? What is the best polling Interval?
    5.1.6 Operating System Clock Interface How will NTP discipline my Clock?
    5.2. The Kernel Discipline
    5.2.1 Basic Functionality What is special about the Kernel Clock? Does my Operating System have the Kernel Discipline? How can I verify the Kernel Discipline?
    5.2.2 Monitoring
    5.2.3 PPS Processing What is PPS Processing? How is PPS Processing related to the Kernel Discipline? What does hardpps() do?
    5.3. NTP in real Life
    5.3.1 What if I write my own SNTP Server?
    5.3.2 Why should I have more than one clock?
    5.3.3 Does the reference time depend on all configured servers, or is it based on which ever responds first?
    5.3.4 What happens during a Leap Second?
    5.4. Encryption
    5.4.1 What is Encryption used for in NTP? How is Authenticity verified? Where are authenticated Messages used in NTP? How is Performance affected by Encryption?
    5.4.2 The Basics of Autokey Authentic and Proventic Secure Group and Trusted Host Identity Schemes Proventic Trail Session Keys

  6. Configuration
    6.1. Basic Configuration
    6.1.1 Can’t I just run ntpdate?
    6.1.2 Recommended Minimum What is the minimum configuration? Is the minimum configuration a typical one? What is the correct Pseudo IP Address for my reference clock? What is a drift file? Should I use IP addresses or host names?
    6.1.3 Running an isolated Network Can I use my system clock as reference clock? Can I avoid manual time adjustments in a network without reference clock?
    6.1.4 Recommended Goodies How can I configure the amount of logging information? How can I speed up initial Synchronization? How do I configure remote administration? How do I use authentication keys? What are all the different Keys used for? How do I use autokey?
    6.1.5 Miscellaneous Hints What is the preferred etiquette when synchronizing to a public server? Where can I find public Time Servers?
    6.2. Advanced Configuration
    6.2.1 Server Selection What is the rule of thumb for number of servers to synchronize to? Should the servers be a mix of primary and secondary servers? How should I provide NTP services for a huge network?
    6.2.2 Authentication Why Authentication? How is Authentication applied? How do I create a key? How does Authentication work? Can I add Authentication without restarting ntpd? How do I use Public-Key Authentication (autokey)?
    6.2.3 Broadcasting, Multicasting, and Manycasting How do I configure a Broadcast Server? How do I configure a Broadcast Client? Why doesn’t Broadcasting work with LCL? How do I configure Multicast Servers and Clients? What is Manycasting?
    6.2.4. PPS Synchronization Which components are required to use PPS synchronization? What changes are required in ntp.conf? How do I verify that everything is working? Special Drivers What is a PPS peer? How do I use PPS with the Motorola Oncore driver? How do I use PPS with the NMEA driver? What is the PPS API? What is the shortest Width for a Pulse connected to the DCD Pin of an RS-232 Interface?
    6.2.5 Automatic Configuration How can I define the address of an NTP server in a BOOTP reply? How do I use information about NTP servers given in a BOOTP reply?
    6.2.6 Offering Time Service Is there any way to configure ntpd to attach to a specific Interface? Should Access be restricted? What should be done before announcing public NTP service?
    6.3. Various Tricks
    6.3.1 Mixing Time Protocols
    6.3.2 Avoiding Time Steps
    6.3.3 Using the Echo Feature in PPS API
    6.4. Compatibility
    6.4.1 The Kernel PLL How many different kernel models and implementations exist? What’s new in each Version? Are the individual kernel models compatible? Is the Linux implementation different?

  7. Reference Clocks
    7.1 What is LCL, the Local Clock?
    7.2 GPS Receivers
    7.2.1 What should I know about various GPS Receivers?
    7.2.2 What are PDOP, TDOP, and GDOP?
    7.2.3 What is NMEA?
    7.2.4 What is TSIP?
    7.3 DCF77 Receivers
    7.3.1 What should I know about DCF77 Receivers?
    7.3.2 What can make my DCF77 Receiver fail?
    7.4 Other Receivers
    7.4.1 What can make my MSF Receiver fail?
    7.4.2 How can I find a low-cost Receiver for Low-Frequency Transmissions?
    7.5 Products
    7.5.1 Where can I find a reference clock for NTP?

  8. Troubleshooting
    8.1 Monitoring
    8.1.1 How do I confirm my NTP server is working fine?
    8.1.2 How do I use peerstats and loopstats?
    8.1.3 How can I see the Time Difference between Client and Server?
    8.1.4 What does 257 mean as value for reach?
    8.1.5 How do I use statistics files?
    8.2. General Issues
    8.2.1 Starting, running, querying How can I check that ntpd is up and running? Why does ntpd only run for about 10 to 20 minutes??
    8.2.2 Cabling and Interfacing Why does my Serial Interface hang when I connect a PPS Signal to DCD? Why is the PPS API only detecting one Edge?
    8.2.3 Exchanging Time Is a remote server providing time? My server is up and running, but it is unusable for clients
    8.2.4 Cryptography No time received when using autokey
    8.2.5 Time Errors Why does my server change time references quite frequently? My server periodically loses synchronization Why does my system step several times a day?
    8.2.6 Other How do I set the correct value for tick? How do I set the precision? ntpd periodically opens a dial-out connection. Can I avoid that? Any more Hints?
    8.2.7 Errors and Warnings ntpq: read: connection refused timed out, nothing received, Request timed out ntpdate: no server suitable for synchronization found configure: keyword “precision” unknown, line ignored Previous time adjustment didn’t complete sendto: Overlapped I/O operation is in progress.
    8.3. Troubleshooting Specific Products
    8.3.1 PC Hardware How accurate is the CMOS clock? How can I set the CMOS clock? How can I read or write the CMOS clock? How can SMM affect Interrupt Processing?
    8.3.2 Linux What does set_rtc_mmss: can’t update from 54 to 5 mean? Why does my Linux system lose several milliseconds every once in a while.
    8.3.4 Serial Port Do Multiport Serial Cards cause Trouble? Why does my DCF77 Receiver not get Power from the serial Port?
    8.3.5 Oncore Compatibles Will the M12 work with the Oncore driver? Why is the UT+ reporting clk_noreply?
    8.3.6 Solaris What is dosyncdr? What causes occasional 2s Time Steps?
    8.3.7 Trimble Clocks Only one Edge of my Trimble Acutime’s PPS Pulse is detected
    8.4. Reporting Bugs
    8.4.1 When should I report a Problem?
    8.4.2 What should I report?

  9. Background and Related Information
    9.1 Miscellaneous
    9.1.1 What is Mills-speak?
    9.1.2 How can I convert a date to NTP format?
    9.1.3 How can I convert an NTP Timestamp to UNIX Time?
    9.1.4 Where can I find more Information?
    9.2 GPS
    9.2.1 Selective Availability revisited

  10. Common Terms and Acronyms

This document tries to explain the most basic features of NTP, and to answer many frequently asked questions. The intention is to help the average user to get a quick start with the official implementation of NTP. Technical issues and mathematics are avoided where possible. Instead the most common questions are tried to be answered, enabling everybody to get a working configuration.

All we do here is invent games to pass the time.
John O' Donohue

1. About this Document

The NTP FAQ and HOWTO was originally edited by:
Ulrich Windl
Dale R. Worley
David Dalton, Hewlett-Packard
Marc Martinec, Josef Stefan Institute

with this copyright notice:

Copyright © 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Ulrich Windl, et al. (see credits)

The material in this document is covered by the respective contributor’s copyright. © Copyright 1999 - 2005, by the contributors and editors of this document. For details see the list of editors and authors.

All editors and contributors (non-exclusively) grant a perpetual, irrevocable, and royalty free license to distribute this document under the terms of the General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This document is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

If you don’t already have the GNU General Public License at hand, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

It is now maintained by Network Time Foundation. Contributions to update the material are most appreciated and contributors will continue to be added to the credits.

1.1 Preface

This section tries to answer questions about the document itself. This document is intended for beginners as well as advanced users that are looking for advice. However, basic skills in system administration are required to enjoy this tour. True experts on the subject will probably prefer the original documentation that comes with the software, or make corrections where it is wrong.

The impatient may want to go directly to Section 2 where fundamentals of timekeeping are discussed. Section 3 introduces clocks that are implemented using computers. If you are reading sequentially, you should be ready for the section that presents NTP, Section 4.

At that point focus moves from a more theoretical treatment of the subject to practical aspects, starting with Section 5. Then Section 6 moves into configuration of the NTP software. Section 7 will talk about reference clocks.

Real life is talked about in Section 8 where procedures, tips, and tricks for troubleshooting are presented. For the curious, Section 9 provides further information and references. Finally, there is a glossary of terms.

1.2 Why is this Document named FAQ and HOWTO?

This document tries to answer frequently asked questions (FAQs) that can not (at least virtually) be answered easily from the standard documentation.

In addition to just answering user questions, this document also tries to give a gentle introduction and guidelines to the newcomer. The authors believe that it’s better to use NTP correctly right from the start rather than fixing all the problems after they occur.

“Gentle” means “not too technical” and “not too theoretical”. However, some basic non-trivial understanding of real life is required at several points, so please accept these deviations from the goal.

1.3 Where is the source of this document?

The source files for the FAQ can be found here. The repository also contains the HTML files for the FAQ and a README for obtaining the source files.

1.4 Why can’t I find information about xyz in this FAQ?

Unless it simply has not been written yet, there may be other reasons:

  1. The editors don’t want to copy documentation that is already publicly available. This is especially true for standards, specifications, and manuals. The editors think that referring to is better than copying. The intention is to avoid redundancy while saving labour.
  2. Either the problem or the solution is too vague to document it. This is true for uncommon configurations. After all, we want to answer frequently asked questions here.

1.5 Where should a new Entry be put?

The answer to this question is quite delicate! The guidelines are probably these:

1.6 Why should I contribute?

In “the good old times” the Internet was a valuable source of information, and people were happy to share their knowledge. These days, however, people think of E-Commerce, how to make money.

This FAQ was written not to make money, but to have a reference to refer to and to provide information to more people. If you have solved some NTP problem that may be of interest to other people, please share your experience.

1.7 How can I contribute?

Contributions are very much appreciated. You can:

  1. Correct errors or incomplete information.
  2. Suggest an addition consisting of a question together with its answer.
  3. Update examples so they match the current NTP version.

1.8 I contributed to this FAQ, but my name is not mentioned anywhere. What’s wrong?

Probably the fault of the editor. Maybe he thought you don’t want to be listed, or simply forgot. Section 1.10 shows the names the editor was aware of.

1.9 Why are Graphics stored in PNG Format?

The popular GIF format supported by many browsers relies on a compression algorithm that is patented, and the owner of the patent wants to receive money from everyone making GIF files. PNG (Portable Network Graphics) uses a different algorithm for compression and does not require payment.

1.10 Credits

If you contributed to this FAQ, and you could not find your name elsewhere, this is where it should be.

This is an alphabetical list of contributors: