1

I have an isolated and air-gapped LAN that I want to synchronise. I have one host that will be the authoritative time server for all clients on the LAN. It's not important that the LAN time reflects real time, but it is important that all the clients agree on the time. All hosts are running Linux.

I had hoped to configure chronyd such that it would use the RTC on the nominated host as the authoritative time source, and provide an NTP service to clients so that they can synchronise with it. Therefore if the administrator needs to change the time on the LAN, they can update the RTC on the time server and everything should fall into sync given enough time.

Unfortunately I am not having much luck configuring chronyd in this way. If I don't specify any time servers ("server ..." in /etc/chrony/chrony.conf) then chronyd seems to operate with no sources, rather than using the local RTC as a source.

The refclock config parameter can be used to select an external time source such as GPS or PPS, but none of the drivers seem appropriate for reading the RTC.

One idea I had is to write a small application to read the RTC and provide it as PPS data over the SOCK driver, but further reading showed that this requires an NTP source as well since it's a sub-second measurement and not the absolute time.

Is it possible to use chronyd in this way?

davidA
  • 353
  • 2
  • 11

2 Answers2

1
local 

by itself in chrony.conf is sufficient to enable local system as reference.

RTCs are not perfect, they drift a lot. If you only need precision not accuracy, this may be acceptable.

Other directives are also useful.

# Local self reference
local

# Allow chronyc settime where a person can type the time
# Drift is estimated from these inputs
# Useful in environments without other reference clocks
manual    

# Recording drift is especially important
# when timestamps are few and far between
driftfile /var/lib/chrony/drift

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC
John Mahowald
  • 30,009
  • 1
  • 17
  • 32
  • Thank you for the clarification. Yes, in this case precision is needed - the hosts on the network must all agree on the current time (to within some tolerance), but if that's not actually real time then that's acceptable as long as it's roughly correct (within minutes over months) and can be manually corrected from time to time. – davidA Feb 09 '22 at 21:48
0

To answer my own question, I found the Isolate-networks documentation to be partially relevant, in particular setting chrony.conf to include:

local stratum 8
manual

This seems to pick up the time from RTC initially, so perhaps the use of settime is not needed? I'm not sure if manual is necessary.

davidA
  • 353
  • 2
  • 11