Zeitserver setzen/ändern (chrony / systemd-timesyncd)

wen man einen lokalen Zeitserver im Netzwerk hat und diesen nutzen möchte anstatt das jeder Client extern anfragt, kann man das ganz leicht setzen oder ändern.

Proxmox und Proxmox Backup Server

Datei anpassen, den pool auskommentieren und Zeile hinzufügen, die IP 10.10.10.1 ist unser lokaler Zeitserver
/etc/chrony/chrony.conf

# Use Debian vendor zone.
#pool 2.debian.pool.ntp.org iburst
server 10.10.10.1 iburst

Dienst neustarten

systemctl restart chronyd

Status überprüfen

systemctl restart chronyd
root@proxmox:~# systemctl status chronyd
● chrony.service - chrony, an NTP client/server
     Loaded: loaded (/lib/systemd/system/chrony.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-12-08 15:55:49 CET; 18s ago
       Docs: man:chronyd(8)
             man:chronyc(1)
             man:chrony.conf(5)
    Process: 3936708 ExecStart=/usr/sbin/chronyd $DAEMON_OPTS (code=exited, status=0/SUCCESS)
   Main PID: 3936711 (chronyd)
      Tasks: 2 (limit: 76772)
     Memory: 1.3M
        CPU: 16ms
     CGroup: /system.slice/chrony.service
             ├─3936711 /usr/sbin/chronyd -F 1
             └─3936712 /usr/sbin/chronyd -F 1

Dez 08 15:55:49 proxmox systemd[1]: Starting chrony.service - chrony, an NTP client/server...
Dez 08 15:55:49 proxmox  chronyd[3936711]: chronyd version 4.3 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG)
Dez 08 15:55:49 proxmox  chronyd[3936711]: Frequency -73.359 +/- 0.058 ppm read from /var/lib/chrony/chrony.drift
Dez 08 15:55:49 proxmox  chronyd[3936711]: Using right/UTC timezone to obtain leap second data
Dez 08 15:55:49 proxmox  chronyd[3936711]: Loaded seccomp filter (level 1)
Dez 08 15:55:49 proxmox  systemd[1]: Started chrony.service - chrony, an NTP client/server.
Dez 08 15:55:53 proxmox  chronyd[3936711]: Selected source 10.10.10.1
Dez 08 15:55:53 proxmox  chronyd[3936711]: System clock TAI offset set to 37 seconds

Debain/Ubuntu

Datei anpassen, die IP 10.10.10.1 ist unser lokaler Zeitserver
/etc/systemd/timesyncd.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it under the
#  terms of the GNU Lesser General Public License as published by the Free
#  Software Foundation; either version 2.1 of the License, or (at your option)
#  any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file (or a copy of it placed in
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
# the /etc/systemd/timesyncd.conf.d/ directory. The latter is generally
# recommended. Defaults can be restored by simply deleting the main
# configuration file and all drop-ins located in /etc/.
#
# Use 'systemd-analyze cat-config systemd/timesyncd.conf' to display the full config.
#
# See timesyncd.conf(5) for details.

[Time]
NTP=10.10.10.1
#FallbackNTP=ntp.ubuntu.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
#ConnectionRetrySec=30
#SaveIntervalSec=60

Dienst neustarten

systemctl restart systemd-timesyncd

Status abfragen

systemctl status systemd-timesyncd
root@VM-Ubuntu:~# systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-12-08 15:50:43 CET; 2s ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 58804 (systemd-timesyn)
     Status: "Initial synchronization to time server 10.10.10.1:123 (10.10.10.1)."
      Tasks: 2 (limit: 9328)
     Memory: 1.3M
        CPU: 58ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─58804 /lib/systemd/systemd-timesyncd

Dez 08 15:50:43 VM-Ubuntu systemd[1]: Starting Network Time Synchronization...
Dez 08 15:50:43 VM-Ubuntu systemd[1]: Started Network Time Synchronization.
Dez 08 15:50:43 VM-Ubuntu systemd-timesyncd[58804]: Initial synchronization to time server 10.10.10.1:123 (10.10.10.1).