Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
Issue
- NTP rejects a server with the following flash code:
flash=400 peer_dist
- There are no other available NTP servers that offer more reliable time.
Resolution
- Adding the line
tos maxdist [NUM]
to the ntp configuration file ( /etc/ntp.conf by default) before any lines starting with 'restrict' or 'server' tunes the threshold for which ntp rejects servers or not.
Root Cause
- The default value for maxdist is 1.5 seconds.
- The threshold is determined by a few factors broadcast by the ntp servers themselves. From the official ntp debugging page:
The synchronization distance, defined as one-half the delay plus the dispersion, represents the maximum error statistic. The jitter represents the expected error statistic. The maximum error and expected error calculated from
the peer variables represents the quality metric for the server. The maximum error and expected error calculated from the system variables represents the quality metric for the client. If the root synchronization distance for
any server exceeds 1.5 s, called the select threshold, the server is considered invalid.
- By increasing the size of this value, it tells ntp to trust time servers that would generally be discarded as unreliable. This will allow ntp to sync against these servers. From the man page ntp_misc:
maxdist maxdistance
Specify the synchronization distance threshold used by the clock selec‐
tion algorithm. The default is 1.5 s. This determines both the minimum
number of packets to set the system clock and the maximum roundtrip
delay. It can be decreased to improve reliability or increased to syn‐
chronize clocks on the Moon or planets.
NOTE: It is important to identify that by doing this you are changing the accuracy of ntp. This will allow the time to be synced against a time source that by default ntp recognizes as unreliable. In doing this, the time will sync consistently against this source meaning it will be consistent, but not necessarily accurate.