How to Build a NTP Server

Network Time Protocol is utilised by computer networks and the internet world-wide to provide time synchronisation. The NTP application is actually ‘open source’ software that anyone can download and use. By using a relatively low-cost hardware time reference, anyone can build a stratum 1 NTP server. In this article, we describe how to build and configure a time reference for accurate time distribution on a computer network.

Most Linux distributions are provided with the NTP application pre-installed. If it’s not pre-installed, then it is generally available as an installable package. Worst-case, the application can be downloaded as source code from the NTP website, www.ntp.org, for compilation on a host computer.

Hardware Reference Clocks

To provide a NTP server with stratum 1 operability, a hardware reference clock is required. A hardware reference clock is a device that can receive accurate time, generally from a broadcast time source. The most common clocks used for timing are GPS based. Few realise that the Global Positioning System used by typical car satellite navigation systems, can also provide an extremely accurate time reference. There are also a number of national radio transmissions of time and frequency information that can be used as a source of precise time. In the UK, the MSF radio time and frequency broadcast is transmitted from Anthorn in Cumbria. In Germany, the DCF-77 signal is transmitted from Frankfurt. The US has the WWVB signal broadcast from Colorado. All provide an accurate time reference that can easily be received with a relatively low-cost radio receiver.

The GPS system is particularly useful, since it is available globally. Additionally, with the introduction of consumer GPS satellite navigation systems, prices for GPS receivers has tumbled.

Almost all low-cost GPS receivers have a USB or serial port that can be used to interface to a computer. The receivers output a continuous stream of positioning and timing information that can be interpreted by a computer. There are many different protocols that are used for communication, but by far the most common is the NMEA protocol. NMEA defines a number of sentences that can be generated by a GPS receiver to provide location and timing information as well as status information such as signal lock indication and number of satellites currently in view. More specific receivers intended for timing often also provide a pulse-per-second (PPS) output. The PPS output provides a highly accurate marker indicating the start of each second. Generally, PPS signals are provided in a low-voltage format (5V) rather than a format that can be used with a serial port. Therefore, you may need to perform some signal conditioning to convert 5V signals to the more familiar +\- 12V signals associated with serial inputs.

About the Author

Diane Shinton has spent most of her career in the Data Collection and Information Technology industry. For more than 10 years, Diane has been a Director at TimeTools Limited. She regularly attends seminars and writes articles about NTP servers and network time synchronisation solutions.

Additional Information

Network Time Clock Sources