nixCraft Poll

Topics

Linux ntpd trouble - clock shows difference in milliseconds

Posted by Vivek Gite [Last updated: November 3, 2006]

At first, you may think what is the big deal? Clock is off by a few milliseconds only. One of our client runs application which totally depends upon system clock. If clock (system time) is off by a few milliseconds, application do some sort of miscalculation. I was told - this is intolerable and I must fix the problem.

First this Linux cluster access by end users, internal users and selected retailers. As a result there is always heavy duty activity/traffic going on. This may have result into increased check in intervals. Here is what ntpd man page says:
This version of NTP includes an intricate state machine to reduce the network load while maintaining a quality of synchronization consistent with the observed jitter and wander. There are a number of ways to tailor the operation in order enhance accuracy by reducing the interval or to reduce network overhead by increasing it. However, the user is advised to carefully consider the consequenses of changing the poll adjustment range from the default minimum of 64s to the default maximum of 1,024s

Due to network load interval was somehow touching between 700-1,024 seconds (12-17 minutes).

To fix this problem...

According to ntpd man page:
The initial delay to set the clock can be reduced using the iburst keyword with the server configuration command. It allows for faster Sync with upstream server. Please note that setting iburst on public servers is not good idea (we have our own in house NTP server).

Open /etc/ntp.conf file:
# vi /etc/ntp.conf
Find out server line and add iburst keyword:
server time.preimum.xyz.com prefer iburst
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

Close and save the file. Restart ntpd:
# /etc/init.d/ntpd restart

Now set up a cron job as follows (update clock every 2 minutes):
# crontab -e
Append following line:
*/2 * * * * root /usr/sbin/ntpd -q >/dev/null 2>&1
Close and save the file. Restart crond:
# /etc/init.d/crond restart

Now clock is on time and everything is working fine :D

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Ambresh Says:

    QUESTION :
    TOPIC : Time Synchronization by NTP software

    I have a small network and all of them running Linux OS.I wish to synchronize time with NTP.
    The question is if i take locl clock of one mid node(Nethwork monitoring node) ad reference clock ,What accuracy can be achieved ??

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.