Linux NTP (Short Practical Guide)

Accurate time is required for TLS, logs, monitoring, cron jobs, and distributed systems. In Linux, use one time-sync service only.

1) Check current time sync status

timedatectl status

Look for:

  • System clock synchronized: yes
  • NTP service: active

chrony is usually the best default for servers and unstable networks.

Install and enable:

# Debian/Ubuntu
sudo apt update && sudo apt install -y chrony
sudo systemctl enable --now chrony

# RHEL/CentOS/Fedora
sudo dnf install -y chrony
sudo systemctl enable --now chronyd

Basic config file:

  • Debian/Ubuntu: /etc/chrony/chrony.conf
  • RHEL/Fedora: /etc/chrony.conf

Example servers:

pool pool.ntp.org iburst
# or use your regional pools, for example:
# pool 0.pool.ntp.org iburst
# pool 1.pool.ntp.org iburst

Apply changes:

sudo systemctl restart chrony || sudo systemctl restart chronyd

Verify:

chronyc tracking
chronyc sources -v

3) Lightweight option: systemd-timesyncd

Good for simple desktops/VMs.

Config file: /etc/systemd/timesyncd.conf

[Time]
NTP=0.pool.ntp.org 1.pool.ntp.org
FallbackNTP=time.cloudflare.com time.google.com

Enable and verify:

sudo systemctl enable --now systemd-timesyncd
systemctl status systemd-timesyncd --no-pager

4) Legacy option: ntpd

Use only if your environment specifically requires it.

sudo apt install -y ntp
sudo systemctl enable --now ntp

5) Important rule: run only one service

Do not run chrony, systemd-timesyncd, and ntpd together.

Check what is active:

systemctl is-active chrony chronyd systemd-timesyncd ntp 2>/dev/null

Disable extras (example):

sudo systemctl disable --now systemd-timesyncd ntp

6) Useful practical commands

Force immediate sync step (chrony):

sudo chronyc -a makestep

Show local and UTC time quickly:

date
date -u

Check NTP peers reachability:

chronyc sources -v

7) Quick troubleshooting

  • Verify DNS resolution for NTP servers.
  • Ensure UDP 123 is allowed by firewall/network policy.
  • Confirm only one NTP service is running.
  • If VM time drifts badly, check host clock and hypervisor time settings.

Quick checklist

  • Install one NTP service (chrony preferred).
  • Configure trusted NTP servers.
  • Enable service on boot.
  • Verify sync with timedatectl and service-specific tools.
  • Keep firewall and DNS correct.