Use custom NTP server(s)

hostos

#1

In some networks time synchronization using public NTP servers is prohibited (NTP protocol is usually blocked in corporated firewalls). How can we set custom NTP servers in host config in this case?


#3

Have a look at Chrony - it may provide a workaround for your particular requirements.

https://chrony.tuxfamily.org/comparison.html


#4

Hi, currently that’s not possible, but we are working on adding this to the platform at the moment, see the linked issue below.

https://github.com/resin-os/resinos/issues/328

Probably would not recommend using Chrony as mentioned above, since then there will be two ntp services competing with each other, and unsure what might be the outcome.


#5

You can always remove the NTP service completely and just use Chrony.


#6

Not from the hostOS, you can’t remove it from there per se (systemd-timesyncd running there).

Having said that, could possibly tell the hostOS systemd service over the dbus interface not to sync, and use the in-container anything (e.g. in-container systemd-timesyncd, or chrony) to replace it… This would worth a try, we will also check it out as a workaround! Cheers for provoking more thoughts! :slight_smile:


#7

A follow-up to this:

I tried to disable the hostOS systemd service, but encountered the following error:

“Error System.Error.EROFS: File /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service: Read-only file system”

The command was:

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
dbus-send
–system
–print-reply
–reply-timeout=2000
–type=method_call
–dest=org.freedesktop.timedate1
/org/freedesktop/timedate1
org.freedesktop.timedate1.SetNTP
boolean:false boolean:false


#8

Hey @timo,

A quick update on this.

NOW

Hi there,

Starting from resinOS 2.1.0, you can configure your own NTP servers in the config.json on the boot partition, for example:

"ntpServers": "0.resinio.pool.ntp.org 1.resinio.pool.ntp.org"

You can also check https://docs.resin.io/reference/resinOS/time/ for more details

Best, Kostas