RedHat 7/8 – Sync NTP

It is important to maintain correct system time. The Network Time Protocol (NTP) is the standard way for machines to provide and obtain correct time information on the internet. A machine can get the accurate time info from public NTP services on the internet or local NTP services.

To show overview of the current time related settings including current time, time zone and NTP Sync setting, timedatectl command can help to generate the info

In RedHat 7/8, chrony service is used to sync NTP Service. But chrony service is not installed when you perform mininum installation on your RedHat. So, you need to install chrony service before proceed to set the NTP

To do so, just enter follow command to install

yum install chrony

By default, the chronyd service uses services from the NTP Pool project for the time synchronization.

If you would like to change the NTP time source to local NTP server, you just need to edit /etc/chrony.conf file to specify the local NTP server as the NTP time source. You may use vi /etc/chrony.conf command to edit the configuration file. Below are the steps:-

i) vi /etc/chrony.conf

ii) comment current NTP pool

iii) add local NTP server. In my example, my NTP server IP is 10.111.248.206

It is recommended to include the iburst option to speed up the initial time synchronization.

iv) Start or Restart chronyd service.

systemctl start chronyd

or

systemctl restart chronyd

v) Use the timedatectl command to verify that the server currently has the time synchronization enabled.

vi) Use the chronyc command to verify that the server is currently synchronizing its time with NTP server

chronyc sources -v

Leave a Reply

Your email address will not be published. Required fields are marked *