Single NTP server on isolate network
Solution 1:
NTP should work fine. Look at some of the options for fast synchronization on start-up. Look at the burst
and iburst
options for the system B. Look at the true
option for the GPS clock source.
Consider using the hardware clock as a backup time source on both systems. Set a higher stratum system B. Something like the following should work:
server 127.127.1.0
fudge 127.127.1.0 stratum 8
Watch the output of ntpq -c peers
to see when you get a trusted clock source. Normally ntp
wants a number of responses from a trusted time source before it trusts it. This is indicated by the first character on each line.
While NTP likes more sources, any odd number of time sources within one stratum level should work well. As you only have two servers and a GPS clock the priority (stratum) of the sources should increase from GPS, clock on server A, clock on server B. Increasing the stratum between each by three or four levels will ensure priorities are respected.
EDIT: If you have the busybox NTP server on server A, it may be worthwhile installing the full ntp server package. Understanding what is happening with server A should go a long way to solving your problem. You will need at least one trusted time source there before server B should trust it. If ntpq -c peers
doesn't work, then you can try ntpdc peers
. Both these commands allow you to query other hosts. A peerstats
log could also be useful.
On server B use ntpclient as documented the busybox ntp howto to log what is happening on it
The clocks should be reasonably close to the correct time if the servers haven't been down for long. If you need to sync the two systems, that should be sufficient. The GPS will bring the time into sync with the real world eventually.
'ntpd -q' synchronizes quickly, but exits (ntpdate behaviour). It needs to be followed by an ntpd
command without the quit option to have continuous synchronization.
EDIT2: I check my server and found one of the servers was off by a second. While fixing this I played with the settings. iburst
gets a server trusted very quickly. true
ensured the clock driver was trusted if there weren't multiple other trusted sources. The clock took a little more than a minute before it was locally trusted and could be trusted remotely.
When testing you should be able to restart the ntpd
process once it is synchronized and test how fast settings work. In the above case Server B may need to be restarted to test how fast it synchronizes. When monitoring ntpd
changes I use a line like:
while ntpq -c peers localhost; do sleep 10; done
The hostname and sleep time are adjusted as require. In some cases I chain two or more ntpq
command lines in the loop. When doing so I use an echo and/or date command to provide an indication of where sets of data change.