Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
Know it before you install
chronyd asks several time sources (NTP servers or pools), picks the best, and slowly adjusts the clock (or steps it once when it is far off). A server can also serve time to your network (allow). The real-time clock (RTC) is kept in sync too.
| Item | RHEL / Rocky / Alma | Ubuntu / Debian |
|---|---|---|
| Package | chrony (installed by default) | chrony (Ubuntu 24.04 uses systemd-timesyncd by default) |
| Service | chronyd.service | chrony.service |
| Config | /etc/chrony.conf | /etc/chrony/chrony.conf (+ /etc/chrony/sources.d/) |
| Tool | chronyc | chronyc |
| Port | 123/udp (only needed to serve time; clients use outgoing UDP 123) | the same |
Install on RHEL, Rocky, Alma and Fedora
Install on Ubuntu and Debian
Installing chrony replaces systemd-timesyncd (only one time service may run):
apt-get update
apt-get install -y chrony
systemctl enable --now chrony
timedatectlFirst configuration: a good client
Use 3–4 sources (or a pool), step the clock at start if needed, and keep the RTC in sync:
pool 2.rhel.pool.ntp.org iburst maxsources 4
server time.cloudflare.com iburst nts
server ntp1.corp.example.com iburst prefer
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
ntsdumpdir /var/lib/chrony
leapsectz right/UTC
logdir /var/log/chrony| Setting | Why |
|---|---|
pool … iburst | Several servers from a pool; iburst = fast first sync. |
server … nts | NTS (Network Time Security): the answers are authenticated, not forgeable. |
prefer | Use your company time server first when it is good. |
makestep 1.0 3 | In the first 3 updates, jump the clock if it is more than 1 s off (after that, adjust slowly). |
rtcsync | Keep the hardware clock right too. |
In the cloud, use the provider's time service: AWS 169.254.169.123 (server 169.254.169.123 prefer iburst), Google metadata.google.internal, Azure uses a host time source (PTP) — follow the cloud docs.
systemctl restart chronyd
chronyc sources -v
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* time.cloudflare.com 3 6 377 32 -142us[ -171us] +/- 12ms
^+ ntp1.corp.example.com 2 6 377 31 +310us[ +281us] +/- 20ms
chronyc tracking
System time : 0.000041 seconds fast of NTP time
Leap status : Normal^* = the source in use, ^+ = good backup, Reach 377 = the last 8 queries all answered.
Serve time to your network
On 2–3 internal time servers, allow your networks to ask them:
allow 10.0.0.0/8
allow 192.168.0.0/16
local stratum 10firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
systemctl restart chronyd
chronyc clientslocal stratum 10 lets the server keep serving time if it loses its upstream sources for a while (clients see it is less trusted).
Daily use: the commands and the real uses
chronyc tracking
chronyc sources -v
chronyc sourcestats
chronyc activity
chronyc makestep
timedatectl
timedatectl set-timezone Asia/Riyadh
timedatectl show -p NTPSynchronizedReal uses at work:
- Every server: correct time for logs, TLS, Kerberos/AD, clusters and backups.
- Internal time servers for networks without internet.
- Monitoring: alert when a server's offset is too big (Node Exporter
node_timex_*metrics).
Make it safe
Security checklist:
- Several sources (at least 3) so one bad server can not move your clock; NTS where possible.
allowonly on real time servers, only for your networks; no open NTP server on the internet.- One time service per host (chrony or timesyncd).
- Servers in UTC is simplest; set the user-facing time zone in apps.
- Watch
chronyc trackingoffset in monitoring.
Update and remove
dnf -y upgrade chrony
apt-get install --only-upgrade -y chronyDo not remove time sync from servers. To switch back to systemd-timesyncd on Ubuntu: apt-get purge chrony && apt-get install systemd-timesyncd.
Fix common problems
| Problem | Cause | Fix |
|---|---|---|
chronyc sources shows ^? and Reach 0 | UDP 123 out is blocked, or DNS fails. | Open outgoing UDP 123; use IPs of internal servers; check DNS. |
| Clock far off and not corrected | makestep only works at the start. | chronyc makestep once; check that makestep is in the config. |
506 Cannot talk to daemon | chronyd is not running. | systemctl start chronyd. |
| Two time services fight | systemd-timesyncd and chrony both active. | Keep one: systemctl disable --now systemd-timesyncd. |
| Clients can not sync from your server | No allow line or firewall. | Add allow NET; open the ntp service; chronyc clients. |
| TLS errors "certificate not yet valid" | Wrong time on the client. | Fix time sync first, then retry. |
Next steps
- Quick how-to: Set the time zone and sync the clock.
- Command page: chronyc, Command page: timedatectl.
- Learn it for RHCSA: Use network time, Configure time service clients, RH134 — Sync the time with chrony.
- Practise: Lab: RHCSA time.
1What do ^* and Reach 377 mean in chronyc sources?
^* is the source in use; 377 means the last 8 queries all got an answer.
2What does makestep 1.0 3 do?
In the first 3 updates, chrony jumps the clock when it is more than 1 second off.