Controlling the Time
Keep time synchronized with the Network Time Protocol.
Tuesday, December 13th, 2005
If you’re a busy system administrator, you’ve probably got a clock displayed on your computer’s screen at all times. The clock is a handy convenience, but it has its problems: computer clocks are notoriously unreliable. After a few days, you may discover that your clock is several minutes off.
If it were just a question of seeing the wrong time on your desktop clock, the unreliability of computer clocks would be nothing more than an annoyance. Unfortunately, there’s more to the problem than that: computer timekeeping is vital for certain functions. For example, the make utility relies on time stamps to determine which files need to be rebuilt; the Kerberos network authentication tool uses time stamps as part of its security system; time stamps are built into email exchanges and are used for troubleshooting them, and so on. Incorrect system times can cause failures in any of these systems, particularly when the time differs from one computer to another.
Fortunately, a solution to inaccurate computer clocks exists: the Network Time Protocol (NTP). NTP is a tool to set one computer’s clock from another one. Using NTP, you can ensure that all the computers on your network have the same time, and that this time is synchronized to the time used by outside computers, all to within a fraction of a second. Once NTP is installed and configured, you’ll never again need to manually reset your computers’ clocks, except perhaps when setting up a new computer.
NTP Principles
The first thing to know about NTP is that it’s hierarchical, as illustrated in Figure One. One time source, such as an atomic clock, maintains a precisely accurate time. This is referred to as a Stratum 0 time source. Ordinarily, Stratum 0 time sources communicate only with Stratum 1 servers. Each Stratum 1 server has the potential to deliver its time to many Stratum 2 servers, each of which in turn can service many Stratum 3 servers, and so on. In practice, the servers on each level are likely to service many more than the two or three computers shown in Figure One. The hierarchy can also extend to an arbitrary number of levels beyond Stratum 3 depicted in Figure One.