# Does Balena OS automatically serve the NTP time with chrony?

**URL:** <https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272>\
**Category:** General\
**Created:** [March 29, 2023, 7:33am UTC](https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272 "2023-03-29T07:33:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melle](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Melle](https://forums.balena.io/u/Melle)\
**Post date:** [March 29, 2023, 7:33am UTC](https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272/1 "2023-03-29T07:33:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![shawaj](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shawaj/32/8203_2.png) [@shawaj](https://forums.balena.io/u/shawaj)\
**Post date:** [March 29, 2023, 2:02pm UTC](https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272/2 "2023-03-29T14:02:51Z")

</div>

Have a look here:

> **[Time management - Balena Documentation](https://docs.balena.io/reference/OS/time/)**
>
> How time is synchronized and managed for balena devices

You can set your own NTP servers in the config.json

---

<div class="post-metadata">

**Author:** ![Melle](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Melle](https://forums.balena.io/u/Melle)\
**Post date:** [March 29, 2023, 3:50pm UTC](https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272/3 "2023-03-29T15:50:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alexgg](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@alexgg](https://forums.balena.io/u/alexgg)\
**Post date:** [April 5, 2023, 10:44am UTC](https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272/4 "2023-04-05T10:44:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Melle](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Melle](https://forums.balena.io/u/Melle)\
**Post date:** [April 6, 2023, 7:29am UTC](https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272/6 "2023-04-06T07:29:41Z")

</div>

Thank you.

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.

---

<div class="post-metadata">

**Author:** ![WesleyGael](https://avatars.discourse-cdn.com/v4/letter/w/f19dbf/32.png) [@WesleyGael](https://forums.balena.io/u/WesleyGael)\
**Post date:** [September 23, 2024, 4:47pm UTC](https://forums.balena.io/t/does-balena-os-automatically-serve-the-ntp-time-with-chrony/367272/8 "2024-09-23T16:47:00Z")

</div>

> [@Melle](#):
>
> I’m a beginner with the NTP time protocol and what comes out of the box, so maybe this is a beginners question[.](https://ultrapanda777.mobi/)
> 
> 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?

Do you need to modify the `/etc/chrony.conf` file to allow time synchronization from peripherals? What are the security implications of adding peers?
