Bryant Labs

NTP How-to

NTP Overview

The Network Time Protocol was created at the University of Delaware by Dr. David Mills around 1980. If you would like to learn more about the history and basic workings of NTP, refer to the Official NTP FAQ

NTP is a way to synchronize two computers via a network in a classic client/server relationship. Generally, the server is closer to a reference time standard than the client, but NTP is also used in a peer-peer relationship for redundancy and fail-safe reasons.

Many people think NTP is fairly crude, only good enough to get within a few seconds. This is due to the fact that many free NTP server software packages(including the one included in Windows XP) only request time from a server every hour or two. If you got this far, you proably already know that a computer's internal clock can drift a long way in two hours. Luckily the solution is easy - get better server software

As far as I know, only one true port of NTP is available for Windows. Meinberg in Germany, a maker of precise time and frequency products, has ported NTP to Windows and they give it away or free.

If, like me, you have a good time reference available you can create your own local time server. This will also give you better synchronization among your computers because the NTP messages only pass through your local network. Setting up an NTP server presents more of a challenge, because you have to run it on Linux unless you are a more dedicated software engineer than I am. Details are below.

Setting up an NTP Client under Windows

First, download the NTP client software from Meinberg here.It has an excellent installer which makes the whole thing pretty painless if you take all of the defaults. It will set up the software to get the time from three servers in the NTP pool project.

I also recommend that you install their Time Server Monitor program. This allows you to monitor the status of NTP, change the settings, and look at the statistics. You can find out what servers are being used for synchronization, and which is the primary.

The real strength of NTP is in the filters. Many years of research have gone into the development of these algorithms which do an excellent job of removing the effects of variable network timing. The downside is that it takes a while for these filters to settle. It can take an hour or more for the system to determine which server is the best.

Setting up your own NTP server

Let's assume that you have a good time source like a WWV or GPS receiver. The first step is to review the list of NTP Reference Clock Drivers supported by NTP to see if your receiver is listed. NTP supports many types of equipment as reference sources.

If your device is listed, then you need to have a system running Linux to support NTP. I had a "surplus" pentium computer with enough resources to run it. Some sites will tell you that you need a fair amount of memory and disk space, but that only applies if you plan to run the graphical UI on top of Linux. I'm only running the command line inteface, so the resources required are quite a bit less. I chose to run Debian for the same reason. Download it or buy a book with the distribution disks and install it on your machine. It went pretty painlessly for me.

If you are running Debian, you can install ntp directly using the apt-get function - see the NTP Installation pages.

Otherwise, download the latest stable NTP distribution from the official site. Then unpack it using gunzip into a working directory. After you've done that, read the "install" file for directions on installing ntp. Once you understand the process and the file locations, proceed with the installation.

The ntp.conf file is a work of art all in itself. For our purposes, we just need to set up the list of servers. The setup process will put three servers in the configuration file. These entries are actually pointers to the ntp pool project, a way to spread out the load on public ntp servers. Ahead of these entries, add one for your local reference clock. This will be of the form: "127.127.r.u " where r is the type of reference clock (5 for my TrueTime XL-DC) and u is the unit number (0 if you have only one). Refer to the Reference clock driver detail page for your clock type for more information.

Hints

The connection between the receiver and your computer can be a challenge. Older devices in particular use non-standard serial port connections. Often there are other signals on the connector. For instance, the TrueTime XL-DC had RS-232 and RS-422 signals on the 9 pin d-Sub connector. My advice (if you can't find the manual...) is to start with just the Transmit Data, Receive Data, and ground. Don't hook up any of the other pins at all.

One thing that stumped me for a little while was making the connection between the serial port on the computer and the "/dev/true" virtual device where the RefClock Driver wanted to find it. If you are a linux guru, this is obvious. To someone like me who is coming back to linux after using Unix many years ago it was long forgotten. Anyway, the answer is to run the command "ln /dev/com1 /dev/true" from the command line. This will establish the required link

This is a work-in-progress.

Back to the Bryant Labs Precise Time and Frequency System Page
Back to Bryant Labs Home Page

Last Revised: 30-December-2005