chrony is a versatile implementation of the Network Time Protocol (NTP). It can synchronize the system clock with NTP servers, reference clocks (e.g. GPS receiver), and manual input using wristwatch and keyboard. It can also operate as an NTPv4 (RFC 5905) server and peer to provide a time service to other computers in the network.
USE flags for net-misc/chrony NTP client and server programs
|Use Linux capabilities library to control privilege
|Support for command and monitoring
|Get DEBUG_LOG output from chronyd when passing -dd parameter
|Install HTML documentation
|Support different hashes via dev-libs/libtomcrypt
|Use dev-libs/nettle for hash functions or nts
|Use dev-libs/nss for hash functions
|Support for the Network Time Protocol (NTP)
|Support for Network Time Security (NTS). Uses net-libs/gnutls
|Support for the PTP (Precision Time Protocol) Hardware Clock (PHC) interface
|Support for the Linux Pulse Per Second (PPS) interface
|Enable support for libreadline, a GNU line-editing library that almost everyone wants
|Support for reference clocks
|Support for the Linux Real Time Clock interface
|Add support for SAMBA (Windows File and Printer sharing)
|Enable seccomp (secure computing mode) to perform system call filtering at runtime to increase security of programs
|Enable support for hashes other than MD5
|!!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
Install the chrony package:
emerge --ask net-misc/chrony
/etc/chrony/chrony.conf is the configuration file for chronyd. The default configuration is populated with:
# Use public NTP servers from the pool.ntp.org project.
pool pool.ntp.org iburst
# Record the rate at which the system clock gains/losses time.
# In first three updates step the system clock instead of slew
# if the adjustment is larger than 1 second.
makestep 1.0 3
# Enable kernel synchronization of the real-time clock (RTC).
Time zones and location of the server do not matter for the NTP protocol; it synchronizes via UTC.
On systems where a network connection is not always available at boot (laptops, etc.), it might help to change the pool line in the server configuration:
pool pool.ntp.org iburst auto_offline
This tells chronyd that the machine will be assumed to have gone offline when 2 requests have been sent to it without receiving a response.
Use the chronyc online command to re-enable polling (See below)
Enable Network Time Security (NTS)
NTS provides cryptographic security on NTP client-server connections using Transport Layer Security (TLS) and Authenticated Encryption with Associated Data (AEAD) RFC8915. In order to use this, set specific servers supporting NTS:
# List of NTS servers:
server time.cloudflare.com iburst nts
server virginia.time.system76.com iburst nts
server ohio.time.system76.com iburst nts
server oregon.time.system76.com iburst nts
server nts.netnod.se iburst nts
server nts.time.nl iburst nts
server ptbtime1.ptb.de iburst nts
server ptbtime2.ptb.de iburst nts
server ptbtime3.ptb.de iburst nts
# NTS cookie jar to minimise NTS-KE requests upon chronyd restart
Most NTP pools do not support NTS.
NTS uses TCP/4460 while standard NTP uses UDP/123.
Use UTC time
chronyd assumes by default that the RTC keeps local time (including any daylight saving changes). To use UTC instead use:
Acting as a local NTP server
By default, chronyd only synchronizes the local machine time. By adding allow and deny rules, it will act as a local NTP source:
# Note order does not matter for this example, order does matter with 'allow all' or 'deny all'
# Allow a specific IP
# Deny the 198.51.100.0/24 subnet (example)
# Allow all of the 192.0.2.0 subnet
To avoid DHCP replacing the local NTP config and the DHCP server is configured with NTP destinations (rare in home use), consider the following configuration options:
chronyc Client Interface Tool
chronyc is a command-line interface program which can be used to monitor chronyd's performance and to change various operating parameters whilst it is running. A full list of commands can be found in the manual, man 1 chronyc
chronyc offline # Set all sources offline
chronyc online # Set all sources online
Add chronyd to the default runlevel to have the time synchronized automatically.
rc-service chronyd start
rc-update add chronyd default
To monitor status of the server:
rc-service chronyd status
To run the chronyd sync service:
systemctl start chronyd.service
To have the chronyd sync service start at boot:
systemctl enable chronyd.service
To monitor status of the chronyd service:
systemctl status chronyd.service
- Ntp — is a suite of tools utilizing Network Time Protocol. Their purpose is to keep the system clock in time.
- OpenNTPD — a lightweight NTP server ported from OpenBSD.
- Network Time Protocol — is used to synchronize the system time with other devices over the network.
- System time — is used in Unix systems to keep track of time.
- Home router — how to turn an old Gentoo machine into a router for connecting a home network to the Internet.
- Configuring chrony to take advantage of PTP and associated NIC clocks