Chrony ist der moderne NTP-Client und -Server für Linux. Er synchronisiert die Systemzeit schneller und genauer als der klassische ntpd, besonders bei intermittierenden Verbindungen.
Installation
# Debian/Ubuntu
apt install chrony
# RHEL/CentOS
dnf install chrony
# Service aktivieren
systemctl enable chronyd
systemctl start chronyd
Grundlagen
Status prüfen
# Synchronisations-Status
chronyc tracking
# Ausgabe:
# Reference ID : C0A80001 (ntp.example.de)
# Stratum : 3
# Ref time (UTC) : Mon Jan 26 10:00:00 2026
# System time : 0.000012345 seconds fast
# Last offset : +0.000001234 seconds
# RMS offset : 0.000123456 seconds
# Frequency : 12.345 ppm slow
# Root delay : 0.012345678 seconds
Quellen anzeigen
# NTP-Quellen
chronyc sources
# Ausgabe:
# MS Name/IP address Stratum Poll Reach LastRx Last sample
# ===============================================================================
# ^* ntp1.example.de 2 6 377 12 +123us[ +456us] +/- 12ms
# ^+ ntp2.example.de 2 6 377 13 +234us[ +567us] +/- 15ms
# ^- ntp3.example.de 3 6 377 14 -345us[ -678us] +/- 25ms
# Detaillierte Quellen-Info
chronyc sourcestats
# Ausgabe:
# Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
# ==============================================================================
# ntp1.example.de 10 5 577 +0.012 0.234 +123us 234us
Symbole
| Symbol | Bedeutung |
|---|
| * | Aktuell verwendete Quelle |
| + | Gute Backup-Quelle |
| - | Nicht verwendete Quelle |
| ? | Verbindung verloren |
| x | Falseticker (unzuverlässig) |
Konfiguration
Client-Konfiguration
# /etc/chrony/chrony.conf (Debian)
# /etc/chrony.conf (RHEL)
# NTP-Server
server ntp1.example.de iburst
server ntp2.example.de iburst
server 0.de.pool.ntp.org iburst
server 1.de.pool.ntp.org iburst
# Pool verwenden
pool de.pool.ntp.org iburst maxsources 4
# Drift-Datei
driftfile /var/lib/chrony/drift
# RTC synchronisieren
rtcsync
# Schrittweise Korrektur
makestep 1.0 3
# Logging
logdir /var/log/chrony
Optionen
| Option | Beschreibung |
|---|
| iburst | Schnelle initiale Synchronisation |
| prefer | Bevorzugte Quelle |
| minpoll | Minimales Abfrage-Intervall |
| maxpoll | Maximales Abfrage-Intervall |
| maxsources | Maximale Anzahl Quellen |
Makestep
# makestep THRESHOLD LIMIT
# THRESHOLD: Sprung erlaubt wenn Offset größer (Sekunden)
# LIMIT: Nur die ersten N Updates springen
# Sprung bei >1s Offset, nur erste 3 Updates
makestep 1.0 3
# Immer springen wenn >1s
makestep 1.0 -1
NTP-Server einrichten
Basis-Server
# /etc/chrony/chrony.conf
# Upstream-Server
pool de.pool.ntp.org iburst maxsources 4
# Lokales Netz bedienen
allow 192.168.0.0/16
allow 10.0.0.0/8
# Bei Verlust der Upstream-Verbindung
local stratum 10
# Broadcast (optional)
broadcast 192.168.1.255
# Logdir
logdir /var/log/chrony
log measurements statistics tracking
Firewall
# UFW
ufw allow 123/udp
# firewalld
firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
Authentifizierung
NTS (Network Time Security)
# NTS-fähiger Server
server time.cloudflare.com iburst nts
# Mehrere NTS-Server
server nts.netnod.se iburst nts
server ptbtime1.ptb.de iburst nts
server ptbtime2.ptb.de iburst nts
Symmetrische Keys
# /etc/chrony/chrony.keys
1 SHA1 HEX:A1B2C3D4E5F6789012345678901234567890ABCD
2 MD5 password123
# In chrony.conf
keyfile /etc/chrony/chrony.keys
# Server mit Key
server ntp.example.de key 1
Manuelle Steuerung
Zeit sofort synchronisieren
# Manueller Sprung
chronyc makestep
# Quellen neu abfragen
chronyc burst 4/4
# Online-Quellen aktivieren
chronyc online
Offline-Modus
# Offline gehen (Laptop)
chronyc offline
# Wieder online
chronyc online
Hardware-Timestamps
PTP-Hardware
# Mit Hardware-Timestamping
server ntp.example.de iburst minpoll 0 maxpoll 0 xleave
# Hardware-Timestamps aktivieren
hwtimestamp eth0
# Für sehr präzise Zeit (Mikrosekunden)
Monitoring
Logs
# Statistiken aktivieren
logdir /var/log/chrony
log tracking measurements statistics
# Logs anzeigen
tail -f /var/log/chrony/tracking.log
chronyc-Befehle
# Alle Quellen mit Details
chronyc sources -v
# NTP-Pakete Statistik
chronyc ntpdata
# Aktivität
chronyc activity
# Ausgabe:
# 200 OK
# 4 sources online
# 0 sources offline
# 0 sources doing burst (return to online)
# Server-Clients anzeigen (als Server)
chronyc clients
Virtuelle Maschinen
VM-Konfiguration
# Schnellere Anpassung für VMs
makestep 1.0 -1
maxupdateskew 100.0
Hypervisor-Zeit ignorieren
# VMware Tools Zeit-Sync deaktivieren
vmware-toolbox-cmd timesync disable
# Hyper-V
echo 2 > /sys/devices/system/clocksource/clocksource0/available_clocksource
Vergleich mit ntpd
| Feature | Chrony | ntpd |
|---|
| Schnelle Sync | ✓ | Langsamer |
| Intermittierende Verbindung | ✓ | Problematisch |
| Ressourcen | Weniger | Mehr |
| Präzision | Sehr hoch | Hoch |
| NTS-Support | ✓ | Begrenzt |
Troubleshooting
Keine Synchronisation
# Quellen prüfen
chronyc sources
# Netzwerk testen
ntpdate -q ntp.example.de
# Firewall prüfen
ss -ulnp | grep 123
# Debug-Modus
chronyd -d -f /etc/chrony/chrony.conf
Großer Offset
# Manueller Sprung
chronyc makestep
# Oder Service neu starten
systemctl restart chronyd
RTC-Sync
# Hardware-Uhr setzen
hwclock --systohc
# Hardware-Uhr lesen
hwclock --show
# In chrony.conf
rtcsync
Backup-Zeitquelle
# Lokale Uhr als Fallback
server 127.127.1.0
local stratum 10 orphan
# GPS als Quelle (mit gpsd)
refclock SHM 0 refid GPS precision 1e-1 offset 0.9999
refclock SHM 1 refid PPS precision 1e-9
Prometheus-Export
# chrony_exporter
docker run -d \
--name chrony-exporter \
-p 9123:9123 \
superq/chrony-exporter
# Metriken: http://localhost:9123/metrics
Zusammenfassung
| Befehl | Funktion |
|---|
| chronyc tracking | Sync-Status |
| chronyc sources | NTP-Quellen |
| chronyc sourcestats | Quellen-Statistik |
| chronyc makestep | Manueller Sprung |
| chronyc activity | Aktivitäts-Status |
| chronyc clients | Verbundene Clients |
| Konfiguration | Beschreibung |
|---|
| server/pool | NTP-Quelle |
| allow | Client-Netz erlauben |
| makestep | Sprung-Schwellwert |
| rtcsync | Hardware-Uhr sync |
| driftfile | Drift-Korrektur |
| Datei | Pfad |
|---|
| Konfiguration | /etc/chrony/chrony.conf |
| Drift | /var/lib/chrony/drift |
| Logs | /var/log/chrony/ |
Fazit
Chrony ist die moderne Wahl für NTP unter Linux. Die schnelle Synchronisation ist ideal für Server und Laptops. NTS bietet sichere Zeitsynchronisation. Die Konfiguration ist einfach und gut dokumentiert. Für Produktivsysteme sollten mehrere NTP-Quellen konfiguriert werden.