What you will read?
To set up an NTP (Network Time Protocol) server on CentOS 8, you’ll use chrony
, which is the default NTP client/server in CentOS 8.
Step 1 – Install chrony
If it’s not already installed:
sudo dnf install chrony -y
Enable and start the service:
sudo systemctl enable chronyd sudo systemctl start chronyd
Step 2 – Configure chrony
as an NTP Server
Edit the config file:
sudo nano /etc/chrony.conf
Look for the default NTP pool lines and keep or change them based on your region:
server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst
Then add this line to allow your LAN clients to sync:
allow 192.168.0.0/16
You can change the subnet to match your network.
Also make sure local stratum
is enabled so your server can serve time if it’s offline:
local stratum 10
Save and close the file.
Step 3 – Restart and Verify the Server
Restart the chrony daemon:
sudo systemctl restart chronyd
Check server status:
chronyc sources
This will show the current time sources and sync status.
Step 4 – Allow NTP Through the Firewall
If firewalld is enabled, open the NTP port:
sudo firewall-cmd --permanent --add-service=ntp sudo firewall-cmd --reload
Step 5 – Confirm NTP Clients Can Sync
On a client machine, point it to your new NTP server:
sudo chronyc add server your-server-ip
Or modify the client’s /etc/chrony.conf
to include:
server your-server-ip iburst
Then restart chrony on the client:
sudo systemctl restart chronyd
Check sync status from client:
chronyc tracking