The NTP FAQ and HOWTO

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


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
    3.3.1.1 How bad is a Frequency Error of 500 PPM?
    3.3.1.2 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
    5.1.1.1 What is a reference clock?
    5.1.1.2 How will NTP use a reference clock?
    5.1.1.3 How will NTP know about Time Sources?
    5.1.1.4 What happens if the Reference Time changes?
    5.1.1.5 What is a stratum 1 Server?
    5.1.2 Time Exchange
    5.1.2.1 How is Time synchronized?
    5.1.2.2 Which Network Protocols are used by NTP?
    5.1.2.3 How is Time encoded in NTP?
    5.1.2.4 When are the Servers polled?
    5.1.3 Performance
    5.1.3.1 How accurate will my Clock be?
    5.1.3.2 How frequently will the System Clock be updated?
    5.1.3.3 How frequently are Correction Values updated?
    5.1.3.4 What is the Limit for the Number of Clients?
    5.1.4 Robustness
    5.1.4.1 What is the stratum?
    5.1.4.2 How are Synchronization Loops avoided?
    5.1.5 Tuning
    5.1.5.1 What is the allowed range for minpoll and maxpoll?
    5.1.5.2 What is the best polling Interval?
    5.1.6 Operating System Clock Interface
    5.1.6.1 How will NTP discipline my Clock?
    5.2. The Kernel Discipline
    5.2.1 Basic Functionality
    5.2.1.1 What is special about the Kernel Clock?
    5.2.1.2 Does my Operating System have the Kernel Discipline?
    5.2.1.3 How can I verify the Kernel Discipline?
    5.2.2 Monitoring
    5.2.3 PPS Processing
    5.2.3.1 What is PPS Processing?
    5.2.3.2 How is PPS Processing related to the Kernel Discipline?
    5.2.3.3 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?
    5.4.1.1 How is Authenticity verified?
    5.4.1.2 Where are authenticated Messages used in NTP?
    5.4.1.3 How is Performance affected by Encryption?
    5.4.2 The Basics of Autokey
    5.4.2.1 Authentic and Proventic
    5.4.2.2 Secure Group and Trusted Host
    5.4.2.3 Identity Schemes
    5.4.2.4 Proventic Trail
    5.2.4.5 Session Keys

  6. Configuration
    6.1. Basic Configuration
    6.1.1 Can’t I just run ntpdate?
    6.1.2 Recommended Minimum
    6.1.2.1 What is the minimum configuration?
    6.1.2.2 Is the minimum configuration a typical one?
    6.1.2.3 What is the correct Pseudo IP Address for my reference clock?
    6.1.2.4 What is a drift file?
    6.1.2.5 Should I use IP addresses or host names?
    6.1.3 Running an isolated Network
    6.1.3.1 Can I use my system clock as reference clock?
    6.1.3.2 Can I avoid manual time adjustments in a network without reference clock?
    6.1.4 Recommended Goodies
    6.1.4.1 How can I configure the amount of logging information?
    6.1.4.2 How can I speed up initial Synchronization?
    6.1.4.3 How do I configure remote administration?
    6.1.4.4 How do I use authentication keys?
    6.1.4.5 What are all the different Keys used for?
    6.1.4.6 How do I use autokey?
    6.1.5 Miscellaneous Hints
    6.1.5.1 What is the preferred etiquette when synchronizing to a public server?
    6.1.5.2 Where can I find public Time Servers?
    6.2. Advanced Configuration
    6.2.1 Server Selection
    6.2.1.1 What is the rule of thumb for number of servers to synchronize to?
    6.2.1.2 Should the servers be a mix of primary and secondary servers?
    6.2.1.3 How should I provide NTP services for a huge network?
    6.2.2 Authentication
    6.2.2.1 Why Authentication?
    6.2.2.2 How is Authentication applied?
    6.2.2.3 How do I create a key?
    6.2.2.4 How does Authentication work?
    6.2.2.5 Can I add Authentication without restarting ntpd?
    6.2.2.6 How do I use Public-Key Authentication (autokey)?
    6.2.3 Broadcasting, Multicasting, and Manycasting
    6.2.3.1 How do I configure a Broadcast Server?
    6.2.3.2 How do I configure a Broadcast Client?
    6.2.3.3 Why doesn’t Broadcasting work with LCL?
    6.2.3.4 How do I configure Multicast Servers and Clients?
    6.2.3.5 What is Manycasting?
    6.2.4. PPS Synchronization
    6.2.4.1 Which components are required to use PPS synchronization?
    6.2.4.2 What changes are required in ntp.conf?
    6.2.4.3 How do I verify that everything is working?
    6.2.4.4 Special Drivers
    6.2.4.4.1 What is a PPS peer?
    6.2.4.4.2 How do I use PPS with the Motorola Oncore driver?
    6.2.4.4.3 How do I use PPS with the NMEA driver?
    6.2.4.5 What is the PPS API?
    6.2.4.6 What is the shortest Width for a Pulse connected to the DCD Pin of an RS-232 Interface?
    6.2.5 Automatic Configuration
    6.2.5.1 How can I define the address of an NTP server in a BOOTP reply?
    6.2.5.2 How do I use information about NTP servers given in a BOOTP reply?
    6.2.6 Offering Time Service
    6.2.6.1 Is there any way to configure ntpd to attach to a specific Interface?
    6.2.6.2 Should Access be restricted?
    6.2.6.3 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
    6.4.1.1 How many different kernel models and implementations exist?
    6.4.1.2 What’s new in each Version?
    6.4.1.3 Are the individual kernel models compatible?
    6.4.1.4 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
8.2.1.1 How can I check that ntpd is up and running?
8.2.1.2 Why does ntpd only run for about 10 to 20 minutes??
8.2.2 Cabling and Interfacing
8.2.2.1 Why does my Serial Interface hang when I connect a PPS Signal to DCD?
8.2.2.2 Why is the PPS API only detecting one Edge?
8.2.3 Exchanging Time
8.2.3.1 Is a remote server providing time?
8.2.3.2 My server is up and running, but it is unusable for clients
8.2.4 Cryptography
8.2.4.1 No time received when using autokey
8.2.5 Time Errors
8.2.5.1 Why does my server change time references quite frequently?
8.2.5.2 My server periodically loses synchronization
8.2.5.3 Why does my system step several times a day?
8.2.6 Other
8.2.6.1 How do I set the correct value for tick?
8.2.6.2 How do I set the precision?
8.2.6.3 ntpd periodically opens a dial-out connection. Can I avoid that?
8.2.6.4 Any more Hints?
8.2.7 Errors and Warnings
8.2.7.1 ntpq: read: connection refused
8.2.7.2 127.0.0.1: timed out, nothing received, Request timed out
8.2.7.3 ntpdate: no server suitable for synchronization found
8.2.7.4 configure: keyword “precision” unknown, line ignored
8.2.7.5 Previous time adjustment didn’t complete
8.2.7.6 sendto: Overlapped I/O operation is in progress.

8.3. Troubleshooting Specific Products
8.3.1 PC Hardware
8.3.1.1 How accurate is the CMOS clock?
8.3.1.2 How can I set the CMOS clock?
8.3.1.3 How can I read or write the CMOS clock?
8.3.1.4 How can SMM affect Interrupt Processing?
8.3.2 Linux
8.3.2.1 What does set_rtc_mmss: can’t update from 54 to 5 mean?
8.3.2.2 Why does my Linux system lose several milliseconds every once in a while.
8.3.4 Serial Port
8.3.4.1 Do Multiport Serial Cards cause Trouble?
8.3.4.2 Why does my DCF77 Receiver not get Power from the serial Port?
8.3.5 Oncore Compatibles
8.3.5.1 Will the M12 work with the Oncore driver?
8.3.5.2 Why is the UT+ reporting clk_noreply?
8.3.6 Solaris
8.3.6.1 What is dosyncdr?
8.3.6.2 What causes occasional 2s Time Steps?
8.3.7 Trimble Clocks
8.3.7.1 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?

  1. 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

  2. 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: