Menu

How to syncronize time in Linux (using ntp, openntpd, systemd-timesyncd and chrony)

Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. The protocol is usually described in terms of a client-server model, but can as easily be used in peer-to-peer relationships where both peers consider the other to be a potential time source. There are a number of implementations.

ntpd@man deamon implementation of NTP which sets and maintains the system time of day in synchronism with Internet standard time servers.

OpenNTPD/OpenNTPD@wiki is an attempt by the OpenBSD team to produce an NTP daemon implementation that is secure, simple to security audit, trivial to set up and administer, and has small memory requirement that synchronizes local clock on the computer with remote NTP server with reasonable accuracy. It’s an alternative to default default NTPD client/server.

systemd-timesyncd is a daemon that has been added for synchronizing the system clock across the network. It implements an SNTP client. In contrast to NTP implementations such as chrony or the NTP reference server this only implements a client side, and does not bother with the full NTP complexity.

## systemd-timesyncd service is available with systemd >= 213 (el7 uses 208), to start and enable it
$ timedatectl set-ntp true
## configuration
# to add time servers or change the provided ones, uncomment the relevant line and list their host name or IP separated by a space
$ cat /etc/systemd/timesyncd.conf
[Time]
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org