Operations 10 min read

Master Chrony on CentOS 7: Precise Time Sync Made Simple

This guide explains what Chrony is, its components and advantages, walks through installation and configuration on CentOS 7, and demonstrates essential chronyc commands for monitoring and managing system time synchronization.

Open Source Linux
Open Source Linux
Open Source Linux
Master Chrony on CentOS 7: Precise Time Sync Made Simple

Software Introduction

Chrony is an open‑source tool that keeps the system clock synchronized with time servers, consisting of two programs: chronyd (the daemon) and chronyc (the command‑line client).

Work Mode

chronyd runs as a background daemon, adjusting the kernel clock and compensating for drift based on NTP servers.

chronyc provides an interactive interface for monitoring performance and configuring the daemon, either locally or on a remote machine.

Advantages

After initial sync it does not stop the clock, avoiding impact on applications that require monotonic time.

Handles temporary asymmetric delays (e.g., network saturation from large downloads) with better stability.

No need for regular server polling, allowing fast sync on intermittently connected systems.

Responds quickly to rapid clock frequency changes, useful for VMs or power‑saving technologies.

Achieves synchronization in minutes rather than hours, reducing time and frequency errors for non‑24‑hour systems.

Installation & Activation

CentOS 7 ships with Chrony pre‑installed; it can act as both a time server and client, offering better performance and simpler configuration than ntp.

Install and start the service

# Install service
yum install -y chrony

# Start service
systemctl start chronyd.service

# Enable at boot (enabled by default)
systemctl enable chronyd.service

Configure firewall

# Allow NTP service (UDP 123)
firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload
chronyc -a makestep

Set timezone

# View date, timezone, NTP status
timedatectl

# List timezones
timedatectl list-timezones

# Set timezone
timedatectl set-timezone Asia/Shanghai

# Set date and time
timedatectl set-time "2015-01-21 11:50:00"

# Force clock sync after timezone change
chronyc -a makestep

Graphical configuration tool

yum -y install system-config-date

Main Configuration

When Chrony starts, it reads /etc/chrony.conf , whose syntax is similar to that of ntpd .

Key Options

Chrony configuration options
Chrony configuration options

If a local NTP service exists, remove the default server lines, add the internal servers, and restart Chrony.

# cat /etc/chrony.conf | grep -v ^# | grep -v ^$
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
stratumweight 0
driftfile /var/lib/chrony/drift
rtcsync
makestep 10 3
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
keyfile /etc/chrony.keys
commandkey 1
generatecommandkey
noclientlog
logchange 0.5
logdir /var/log/chrony

Checking Status

Check NTP source status

# chronyc sourcestats
210 Number of sources = 3
Name/IP Address        NP NR Span Frequency Freq Skew Offset Std Dev
==============================================================================
dns.sjtu.edu.cn        4  3 302   6.440   90.221 +13ms 694us
dns1.synet.edu.cn     0  0   0    0.000 2000.000 +0ns  4000ms
202.118.1.130          7  5 323  -0.174   7.323 -8406ns 303us

Detailed synchronization status

# chronyc sources -v
210 Number of sources = 3
  .-- Source mode '^' = server, '=' = peer, '#' = local clock.
  /.- Source state '*' = current synced, '+' = combined, '-' = not combined,
 |   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
MS Name/IP address       Stratum Poll Reach LastRx Last sample
===============================================================================
^- dns.sjtu.edu.cn        3   7    13    20   +11ms[ +11ms] +/-   98ms
^? dns1.synet.edu.cn      0   8     0   10y   +0ns[  +0ns] +/-    0ns
^* 202.118.1.130          2   6   377   125   -122us[ -305us] +/-   31ms

Set hardware clock

# Set hardware clock to UTC
$ timedatectl set-local-rtc 1

# Enable or disable NTP synchronization
$ timedatectl set-ntp yes|false

# Calibrate time server
$ chronyc tracking

Tool Usage

Common chronyc commands for managing Chrony:
accheck

– Verify if NTP access is allowed for a specific host. activity – Show how many NTP sources are online/offline. add server – Manually add a new NTP server. clients – Report clients that have accessed the server. delete – Remove an NTP server or peer. settime – Manually set the daemon’s time. tracking – Display system time information. help – List all available chronyc commands.

# chronyc
chrony version 1.29.1
Copyright (C) 1997-2003, 2007, 2009-2013 Richard P. Curnow and others
chrony comes with ABSOLUTELY NO WARRANTY.  This is free software, and
you are welcome to redistribute it under certain conditions.  See the
GNU General Public License version 2 for details.
chronyc> activity
200 OK
3 sources online
0 sources offline
chronyc> help
Commands:
accheck <address> : Check whether NTP access is allowed to <address>
activity          : Check how many NTP sources are online/offline
add peer <address> ... : Add a new NTP peer
add server <address> ... : Add a new NTP server
allow [<subnet-addr>] : Allow NTP access to that subnet as a default
allow all [<subnet-addr>] : Allow NTP access to that subnet and all children
burst <n-good>/<n-max> [<mask>/<masked-address>] : Start a rapid set of measurements
clients          : Report on clients that have accessed the server
...
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

System Administrationtime synchronizationCentOSchronyChronycChronyd
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.