Blog post
Setting up NTP sync on Debian with systemd-timesyncd
A quick guide to enable and start NTP time synchronization on Debian using systemd-timesyncd and timedatectl.
Intro
Keeping system time in sync is important for logs, 2FA, and various time-sensitive applications. In this post I will walk through the exact commands I use to enable NTP synchronization on a Debian system.
Prerequisites
- A Debian-based system
- Root or sudo privileges
Install and enable systemd-timesyncd
Install the systemd-timesyncd package, which provides NTP synchronization functionality:
apt install systemd-timesyncd
Enable the service to run at boot and start it immediately:
systemctl enable systemd-timesyncd.service --now
Enable NTP at the system level
Tell systemd/timedatectl to use network time synchronization:
timedatectl set-ntp true
Verify synchronization
You can verify if NTP is active with:
timedatectl status
Look for these lines:
NTP service: activeSystem clock synchronized: yes
If those values are not active yet, wait a minute and run the status command again.
Problems?
If synchronization does not start, first check the service status and logs:
systemctl status systemd-timesyncd.service
journalctl -u systemd-timesyncd.service
Also verify the system has outbound network access to NTP servers (UDP port 123).