Network Time Protocol is used to synchronize clocks among the various network devices. It is a client/server protocol where NTP servers provide time to NTP clients. There are many reasons as to why a device configured as an NTP client might not be able to synchronize with an NTP server.
So it is important to know the root cause of the issue. This can be found out by configuring NTP in debug mode. Follow the steps outlined below to configure NTP in debug mode on a CentOS/RHEL system.
Enabling NTP debug mode
One should use the level number, for example in the /etc/sysconfig/ntpd file one should have :-
# vi /etc/sysconfig/ntpd OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g -D 1"
Alternatively, ntpd can be started from terminal and log can be redirected to a file. For example:
# /usr/sbin/ntpd -n -D 4 &> log
Excerpts from the man page of ntpd about the debugging mode:-
-d – Specify debugging mode. This option may occur more than once, with each occurrence indicating greater detail of display.
-D level – Specify debugging level directly.
After one restarts ntpd in the debug mode, one will see more details, for example:-
# service ntpd start Starting ntpd: ntpd email@example.com Mon Mar 9 14:24:08 UTC 2015 (1) 15 Jun 13:24:50 ntpd: proto: precision = 0.045 usec 15 Jun 13:24:50 ntpd: 0.0.0.0 c01d 0d kern kernel time sync enabled event at 0 0.0.0.0 c01d 0d kern kernel time sync enabled Finished Parsing!! 15 Jun 13:24:50 ntpd: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16 15 Jun 13:24:50 ntpd: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123 15 Jun 13:24:50 ntpd: Listen and drop on 1 v6wildcard :: UDP 123 [...] transmit: at 73 10.0.0.108->126.96.36.199 mode 3 len 48 receive: at 73 10.0.0.108<-188.8.131.52 mode 4 len 48 clock_filter: old sample 6 transmit: at 75 10.0.0.108->184.108.40.206 mode 3 len 48 receive: at 75 10.0.0.108<-220.127.116.11 mode 4 len 48 clock_filter: old sample 8 transmit: at 77 10.0.0.108->18.104.22.168 mode 3 len 48 receive: at 77 10.0.0.108<-22.214.171.124 mode 4 len 48
Final Thoughts / Recommendations
There won't be performance or log size issues. If there would be one anyway it can be dealt with on a case to case basis. It is to analyse sync issues by using the command ntpq instead of using -D option. ntpq command provides more information about the synchronization status with upstream servers.
The suggested commands are:
# ntpq ntpq> peers ntpq> as ntpq> rv [asID]
where [asID] should be replaced with the number that is showed in the previous output, second column.