PC and workstation clocks are not highly accurate and will tend to drift from the correct time over time. To keep the system's clock accurate, one can use the Network Time Protocol (NTP). The fact that a system's clock is off by a few minutes may not seem important at first, but if you have to troubleshoot problems involving multiple systems, you will realize that it can take much longer to troubleshoot if the clocks on the systems vary and you must mentally adjust the times to determine the order of events.
NTP software will provide the capability for a system to contact a time server, which provides an accurate time source. In the United States time servers may be tied back to the time source provided by the National Institutes of Standards and Technololgy (NIST).
Installing and configuring the ntp package on RedHat Linux is detailed below. The example below uses ntp-4.0.99k-15.i386.rpm, which is version 4.0.99k release 15 of the ntp client. If you are using a later version of RedHat Linux, a newer version of ntp may be available for your version of Linux. Except for the RPM file name, the installation and configuration process should be similar.
Install the package, e.g.
rpm --install ntp-4.0.99k-15.i386.rpm.
Edit /etc/ntp.conf file. Add a server line to point to
a publicly accessible time server, e.g.
server 22.214.171.124to use the time server lennier.cc.vt.edu. You then should have lines similar to the following in the ntp.conf file:
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
Use chkconfig to configure the service to start when the sysem boots
chkconfig ntpd on
Start the service.
If you wish to immediately update the time to match that on the time server,
you can use the ntpdate command, e.g.
ntpdate -b lennier.cc.vt.edu.
You can check that the service is functioning with the ntpq command.
remote refid st t when poll reach delay offset jitter
lennier.cc.vt.e Tick.UH.EDU 2 u 34 64 1 28.516 0.340 0.000
LOCAL(0) LOCAL(0) 10 l 9 64 1 0.000 0.000 0.000
You can check to see whether your system is functioning as an NTP server,
which means it will be listening on NTP UDP port 123 by using the netstat
netstat -a | grep "ntp"
udp 0 0 gna.somewhere.com:ntp *:*
udp 0 0 localhost.localdoma:ntp *:*
udp 0 0 *:ntp *:*
You should see the system name followed by ":ntp", which indicates it is listening for connections on the NTP port, UDP port 123.
If you are blocking access to the system with a firewall, you will need to provide a rule for UDP connections to port 123, if you want to allow other systems the capability of obtaining the time from your NTP server.
If you wish to trace the path back through a sequence of time servers
to find the master time source, you can use the ntptrace command.
localhost.localdomain: stratum 3, offset 0.000100, synch distance 0.22896
lennier.cc.vt.edu: stratum 2, offset -0.016537, synch distance 0.04396
time-b.nist.gov: stratum 1, offset -0.012730, synch distance 0.00000, refid 'ACTS'
The example above shows that the system gets its time from lenier.cc.vt.edu, a stratum 2 server, which in turn gets the time from time-b.nist.gov, a stratum 1 server.
- Decibels Linux NTP Tutorial
- NIST Internet Time Service
- NTP - The Network Time Protocol
- ntpq - standard NTP query program
- ntptrace - trace a chain of NTP servers back to the primary source
- US Naval Observatory NTP Network Time Servers
- Using the Network Time Protocol to Sync Your Network
- Keeping Time on Windows Machines