Linux ntpd trouble – clock shows difference in milliseconds

last updated in Categories Linux, Troubleshooting, Tuning

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 prefer iburst

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 😀

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


1 comment

    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 Comment