Linux ntpd trouble – clock shows difference in milliseconds

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 😀

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Ambresh Dec 18, 2006 @ 6:42

    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

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum