Step 1: Install and configure NTP daemon
NTP server package is provided by default from official CentOS /RHEL 7 repositories and can be installed by issuing the following command.
# yum install ntp
2. After the server is installed, first go to official NTP Public Pool Time Servers, choose your Continent area where the server physically is located, then search for your Country location and a list of NTP servers should appear.
restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap
The nomodify notrap statements suggest that your clients are not allowed to configure the server or be used as peers for time sync.
5. If you need additional information for troubleshooting in case there are problems with your NTP daemon add a log file statement which will record all NTP server issues into one dedicated log file.
logfile /var/log/ntp.log
7. NTP service uses UDP port 123 on OSI transport layer (layer 4). It is designed particularly to resist the effects of variable latency (jitter). To open this port on RHEL/CentOS 7 run the following commands against Firewalld service.
# firewall-cmd --add-service=ntp --permanent # firewall-cmd --reload
# systemctl start ntpd # systemctl enable ntpd # systemctl status ntpd
9. After NTP daemon has been started, wait a few minutes for the server to synchronize time with its pool list servers, then run the following commands to verify NTP peers synchronization status and your system time.
# ntpq -p # date -R
# ntpdate -q 0.ro.pool.ntp.org 1.ro.pool.ntp.org