Can’t sync to NTP server when upstream clock is not available

We were doing some software and systems testing this week, this involved setting up a completely isolated network of cameras with their own NTP server for time synchronization across them. The NTP server was configured to broadcast time updates via UDP. Everything worked OK except the NTP server stopped broadcasting once it lost time synchronization with its up-stream clock (which it lost because all connections to external networks were removed).

To resolve this problem and get the NTP server broadcasting again we had to allow it to synchronize with its own internal clock and pretend that it was a stratum 2 time source (accurate timing wasn’t required during this phase of testing).

To do this the following was added to /etc/ntpd.conf (with thanks to this post)

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server     # local clock
fudge stratum 2

Once the change is made, restart the NTP daemon:

sudo /etc/init.d/ntp restart

The first line allows us to sync with the local clock while the second line ‘elevates’ it to stratum 2

This isn’t a brilliant time-base but it allowed us to test basic time synchronization scenarios.