I’m a beginner with the NTP time protocol and what comes out of the box, so maybe this is a beginners question.
Working with a Balena OS instance I can see that chrony deamon chronyd is started and I can execute some monitoring commands with chronyc.
I can also see current setup of chrony in /etc/chrony.conf and it has several peers/servers to sync the time with - it all seems to work fine.
Now my question:
How can an attached peripherals sync its own time with the balena OS? That is, should we first do a command like chronyc add peer IP with the IP of the peripheral to allow access for time synchronization to the Balena OS, or does Balena OS already allow requests for NTP for attached hardware in the same local network?
Yes, I can setup NTP servers in Balena all right, and that works fine. I can see the Balena OS is syncing with the external sources that are set up in the config.json.
My question is: can a peripheral sync with the Balena OS, whereby from the peripheral perspective Balena is acting as the NTP Server, is it necessary to set certain chronyc / chronyd commands to allow peripherals to sync time? I realize this might well be a chrony daemon question about accessibility from outside to the chronyd deamon running on the machine that runs Balena OS.
Hi, balenaOS is using chrony as an NTP client to keep the system time synchornized with reference time servers. What you are describing is an NTP server, so you will need to add one to your containerized application and configure it accordingly. The services running in balenaOS are only meant to serve the hostOS, any other service needs to be implemented in the application.
We found that indeed we can sync to the Balena OS using chrony from a peripheral.
As a test, we simply connected another machine (let’s call it B) via a switch and added the balena-OS IP address as a source as follows.
First we checked if machine B is able to get the time from the Balena OS, which initially is not the case yet. on Machine B:
chronyc accheck 192.168.123.151
209 Access denied
Then we checked on the Balena-OS system if the peripheral machine B is allowed access with the commands
root@balenaos:~# chronyc add peer 192.168.123.169 ← IP of machine B
and
root@balenaos:~# chronyc cmdaccheck 192.168.123.169 ← IP of machine B
208 Access allowed
Machine B:
chronyc add server
then after some time, chrony has synced the time of Machine B with the Balena OS properly, which can be checked on Machine B with the command
chronyc sourcestats
…
has all servers including the balena os host name
So after all it was more about chronyc / chronyd to configure access.