Network Time Protocol (NTP) is a network protocol for synchronizing time with a remote Internet time server.
Chrony is an implementation of NTP that replaces the old Ntpd used in earlier versions of the Enterprise Linux operating system.
I will explain the NTP (Chrony) installation of CentOS 8 and the following two setting methods.
①, configured as an NTP server When configured as an NTP server, the client PC or client server can synchronize the time of the NTP server. ②, configured as an NTP client When configured as an NTP client, the time on the configured NTP server can be synchronized.
# yum install -y chrony
# vi /etc/chrony.conf
Execute the above command and add the following part of the Conf file. This time, set the access permission to synchronize the access time to the client PC of the local network from ** 192.168.0.0 ** to ** 192.168.0.254 **.
#Allow NTP client access from local netwok → Explanation comment
# allow 192.168.0.0/16 Example of setting →
allow 192.168.0.0/24 → Added here
Note. [** / 24 **] represents the number of ** 256 ** IPs from ** 192.168.0.0 ** to ** 192.168.0.255 ** of the subnet mask ** 255.255.255.0 **. ..
# systemctl restart chronyd
# systemctl enable chronyd
Add a firewall rule that allows NTP requests from client PCs.
# firewall-cmd --permanent --add-service=ntp
# firewall-cmd --reload
Add the time to the synchronization using the server set above as the NTP server on the client PC.
You can check the list of clients accessing for synchronization by the time when the following command is executed.
# chronyc clients
# yum install -y chrony
# vi /etc/chrony.conf
Comment out the existing server directive and add a new server directive for the NTP server.
# Use public servers from the pool.ntp.org project.→ Explanation comment out
# Please consider joining the pool (http://www.pool.ntp.org/join.html).→ Comment out about the confirmation site
# pool 2.centos.pool.ntp.org iburst → The current time is synchronized, but this is at the beginning#Add and comment out
server 192.168.0.21 Add the IP address of the NTP server that synchronizes the time → ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥ ‥
# systemctl restart chronyd
Check the time source to make sure the client is reaching the correct NTP server.
# chronyc sources
Output:
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? 192.168.0.21 3 6 1 25 +2525us[+2525us] +/- 87ms
By default, the NTP server is polled and synchronized every 64 seconds, but you can synchronize with the following command without waiting for the synchronization timing.
# chronyc makestep
that's all.
Recommended Posts