Installing a Time Server

Common Linux NTP servers are all derived from the NTP reference software, which is housed at http://www.ntp.org. This server ships with all major Linux distributions, usually in a package called ntp orxntp. The current stable version of the NTP server as I write is 4.1.1, although development versions number up to 4.1.74. Older distributions ship with earlier versions of NTP. For the most part, these versions work in the same way as recent NTP packages, although a few details differ.

NTP servers typically include SysV startup scripts to launch the server at system start time. NTP servers should always be run through SysV or local startup scripts. They continuously monitor the system clock and check its value every few minutes against a reference clock. If the NTP server were run periodically, as from a super server, the server would do a much poorer job of maintaining the system's time. In some cases, you might want to use a client-only NTP program, such as ntpdate, to set a client's clock periodically, such as once a day. The ntpdate program is being abandoned, though, and may or may not even be available with specific distributions' NTP packages.

Once installed, the NTP server package provides a configuration file called /etc/ntp.conf. All major distributions include ntp.conf files that work reasonably well as they're shipped, with the exception of one critical detail: They must be told where to look to set their clocks. This detail is handled by a server line, which looks like this:

server bigben.threeroomco.com

This line tells the server to synchronize its clock with bigben.threeroomco.com. You can include multiple server lines, in which case the NTP server uses various algorithms to determine which server provides the most accurate time signal and synchronizes itself to that source.

Another pair of options you may want to use, particularly on large networks, are broadcast and broadcastclient. You can have your primary NTP server periodically broadcast the current time by using the line broadcast a.b.c.d, where a.b.c.d is the server's own IP address or a multicast address of 224.0.1.1. Other computers on the network then use the line broadcastclient yes to tell them to listen for these broadcasts. This configuration can reduce local NTP-related network traffic, particularly when you have many clients. Ordinarily, clients synchronize themselves with servers every few minutes, and with many local NTP clients, this traffic might become an issue. On a typical small network, though, the local NTP traffic is tiny compared to other network transfers, so this type of configuration isn't required.

0 0

Post a comment