You are on page 1of 2

Configuring a Time Server

One problem with logging events over a network is that differences in system clocks can make
correlating events on different systems very difficult. It is not unusual for the clock on a system to
have drifted considerably. Thus, there may be discrepancies among timestamps for the same events
listed in different log files. Fortunately, there is a protocol you can use to synchronize the clocks on
your system.
Network Time Protocol (NTP) provides a mechanism so that one system can compare and adjust its
clock to match another system's clock. Ideally, you should have access to a very accurate clock as
your starting point

The next best source is from a system that gets its clock setting from one of these reference clocks.
Such systems are referred to as stratum 1 servers. If you can't get your signal from a stratum 1 server,
the next best choice is to get it from a system that does, a stratum 2 server
NTP works in one of several ways. You can set up a server to broadcast time messages periodically.
Clients then listen for these broadcasts and adjust their clocks accordingly. Alternately, the server can be
queried by the client. NTP uses UDP P, typically port 123 .There is also a lightweight time protocol,
Simple Network Time Protocol (SNTP), used by clients that need less accuracy. SNTP is interoperable
with NTP.
For Unix systems, the most common implementation is ntpd, formerly xntpd, which is described here.
This is actually a collection of related programs including the daemon ntpd and support programs such
as ntpq, ntpdate, and ntptrace. You'll want to start ntpd automatically each time you boot your system.
ntpd uses a configuration file, /etc/ntp.conf, to control its operation
The NTP daemon is dual-purpose. It acts as a server, listening for time synchronization requests and providing
the time in response, and as a client, communicating with other time servers to get the correct time and adjust
the local system accordingly

Configuring the Time Server


Setting up your time server requires a small amount of preparation, implementation, and verification. Youll
need to perform the following tasks:
1. Install the NTP software.
2. Locate suitable time servers to serve as reference clocks.
3. Configure your local time server.
4. Start the NTP daemon on the local time server.
5. Make sure that the NTP daemon responds to requests.

Install ntp
The ntp package contains utilities and daemons that will synchronize your computer's time to
Coordinated Universal Time (UTC) via the NTP protocol and NTP servers. The ntp
packageincludes ntpdate (a program for retrieving the date and time from remote machines via a
network) and ntpd (a daemon which continuously adjusts system time).
Installing the NTP software is simple. Use the rpmquery command to make sure that the ntp package is
installed:
$ rpmquery ntp
ntp-4.2.0.a.20040617-4

The version number you see might be slightly different. If the ntp package isnt installed, install it using the
installation tool of your choice before proceeding.

Install the ntp package:


# yum install ntp

You might also like