Previous Section  < Day Day Up >  Next Section

19.1. Introduction

Keeping accurate time on a single PC, or on a LAN, is important for a number of reasons: maintaining accurate timestamps in logs, keeping databases happy, and ensuring that batch jobs and other automated processes run at the right times. Even more important than keeping precisely correct time is keeping all of your servers and workstations synchronized with each other.

Linux includes a motley collection of time and date utilities: ntpdate, hwclock.sh, date, 822-date, tzselect, tzsetup, vcstime, uptime, zdump, ddate, rdate, ctime, and doubtless several more. In olden times, we ran hwclock.sh, rdate, or ntpdate at boottime, or put them in cron jobs for periodic updating. ntp—the Network Time Protocol—replaces all of that. It is best to disable any of the other utilities that are set to run automatically, whether from rc*.d files or cron, and let ntp be your sole timekeeper. With one exception: ntpdate is still useful for making large corrections. If your system time is off by more than 20 or 30 minutes, ntp will take several hours, or even days, to correct it, whereas ntpdate takes care of large corrections instantly.

The command ntpd -g is supposed to replace ntpdate, but it doesn't work well for corrections of more than an hour. If your system time is off by several hours, the ntp documentation tells you to correct it manually. If that works for you, fine; in this chapter, we'll cover how to make the computer do the work.

ntp is implemented on Linux by ntpd, the Network Time Protocol daemon. It is nearly "set it and forget it;" once you have it configured and running, you shouldn't have to do more than make an occasional check to verify it's keeping time correctly.

It is good time server etiquette to configure a single host on your LAN to synchronize with a group of external time servers, and to then use this host to serve your LAN. This prevents you from placing an undue burden on the public time servers, and it keeps your LAN hosts in sync with each other.

In the olden days, admins had to select a list of public time servers to use, from http://www.eecis.udel.edu/~mills/ntp/servers.html. However, due to abuse and users not respecting access policies, http://pool.ntp.org was created. www.pool.ntp.org creates DNS round-robins to automatically spread the load. A nice side benefit is that it's easier to configure.

    Previous Section  < Day Day Up >  Next Section