Linux ntpd trouble – clock shows difference in milliseconds

by on November 3, 2006 · 1 comment· LAST UPDATED November 3, 2006

in , ,

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

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Ambresh December 18, 2006 at 6:42 am

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 ??

Reply

Leave a Comment

Previous post:

Next post: