MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Mon, Aug 23, 2004 11:05 pm

Keeping a Linux System's Time Accurate

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).

On RedHat Linux systems, you can use the ntp package to set up your system to obtain time from a time server using NTP.

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.

  1. Install the package, e.g. rpm --install ntp-4.0.99k-15.i386.rpm.

  2. Edit /etc/ntp.conf file. Add a server line to point to a publicly accessible time server, e.g. server to use the time server You then should have lines similar to the following in the ntp.conf file:

    server # local clock
    fudge stratum 10

  3. Use chkconfig to configure the service to start when the sysem boots

    chkconfig ntpd on

  4. Start the service.

    /etc/init.d/ntpd start

  5. 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 .

You can check that the service is functioning with the ntpq command.

ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
============================================================================== 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 command.

netstat -a | grep "ntp"
udp        0      0    *:*
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 stratum 2, offset -0.016537, synch distance 0.04396 stratum 1, offset -0.012730, synch distance 0.00000, refid 'ACTS'

The example above shows that the system gets its time from, a stratum 2 server, which in turn gets the time from, a stratum 1 server.


  1. Decibels Linux NTP Tutorial
  2. NIST Internet Time Service
  3. NTP - The Network Time Protocol
  4. ntpq - standard NTP query program
  5. ntptrace - trace a chain of NTP servers back to the primary source
  6. US Naval Observatory NTP Network Time Servers
  7. Using the Network Time Protocol to Sync Your Network
  8. Keeping Time on Windows Machines

[/os/unix/linux/network] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo