How to set custom NTP server in Buster

Topics about the Software of Revolution Pi
Post Reply
User avatar
Steven
Posts: 24
Joined: 29 Mar 2019, 12:01

How to set custom NTP server in Buster

Post by Steven »

Hello,

on the localhost/status.html i can see in the config tab there is a deamon for time synchronization.
Wich one is it and where can i find its documentation?

The goal is to set a custom local NTP server.

Thank you!
->Johannes<-

Re: How to set custom NTP server in Buster

Post by ->Johannes<- »

Hi Steven,
on the localhost/status.html i can see in the config tab there is a deamon for time synchronization.
I guess you mean this?

Webstatus.png
Webstatus.png (34.38 KiB) Viewed 3261 times
It is the same, if you start or stop the ntp with this command.

Activate NTP service

Code: Select all

sudo timedatectl set-ntp 1

Deactivate NTP service

Code: Select all

sudo timedatectl set-ntp 0
You can check it with

Code: Select all

timedatectl status
for example:

Code: Select all

/etc/systemd $ timedatectl status
               Local time: Di 2021-06-29 13:22:09 CEST
           Universal time: Di 2021-06-29 11:22:09 UTC
                 RTC time: Di 2021-06-29 11:22:09
                Time zone: Europe/Berlin (CEST, +0200)
[b]System clock synchronized: yes[/b]
              NTP service: active
          RTC in local TZ: no
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The goal is to set a custom local NTP server.
Have a look at this file

Code: Select all

/etc/systemd/timesyncd.conf
There you can entry your local NTP-server in the line NTP=...
The line FallbackNTP=... means, that if your NTP-servers in line NTP do not work, systemd will use the FallbackNTP-servers.

After change the lines (Do not forget to remove the '#' at the beginning of the lines) you can check the status with

Code: Select all

systemctl status systemd-timesyncd
for example:

Code: Select all

 systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   [b]Active: active (running) since Tue 2021-06-29 13:21:41 CEST; 34s ago[/b]
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 13879 (systemd-timesyn)
  [b] Status: "Synchronized to time server for the first time 188.40.142.18:123 (0.debian.pool.ntp.org)."[/b]
    Tasks: 2 (limit: 2199)
   Memory: 980.0K
   CGroup: /system.slice/systemd-timesyncd.service
           └─13879 /lib/systemd/systemd-timesyncd

Jun 29 13:21:40 RevPi1707 systemd[1]: Starting Network Time Synchronization...
Jun 29 13:21:41 RevPi1707 systemd[1]: Started Network Time Synchronization.
Jun 29 13:21:41 RevPi1707 systemd-timesyncd[13879]: Synchronized to time server for the first time 188.40.142.18:123 (0.debian.pool.ntp.org).


Please let me know, if it works for you.

Best regards

Johannes
Post Reply