To configure time synchronization with NTP servers:
Install the chrony package. To do so, run one of the following commands depending on the utilized operating system:
CentOS or Red Hat Enterprise Linux:
yum install -y chrony
SUSE Linux Enterprise Server:
zypper install chrony
Ubuntu, Debian, or ALT Server:
apt-get install chrony
Enable autostart of the chronyd service. To do so, run one of the following commands depending on the utilized operating system:
Ubuntu, Debian, or ALT Server:
systemctl enable chrony
Other operating systems:
systemctl enable chronyd
Depending on the operating system, open one of the following files:
CentOS, Red Hat Enterprise Linux or SUSE Linux Enterprise Server:
/etc/chrony.conf
Debian, Ubuntu, or ALT Server:
/etc/chrony/chrony.conf
Add strings with the IP addresses of those NTP servers with which you want to configure time synchronization. For example:
server <IP address of the NTP server> iburst
Comment the strings beginning with the word pool or server that have the IP addresses of those NTP servers that you do not want to use for time synchronization (to "comment" means to add the # character at the beginning of the string).
If you are using a Windows domain controller for time synchronization, add the following string:
maxdistance 16.0
Save and close the /etc/chrony.conf file.
Restart the chronyd service. To do so, run one of the following commands depending on the utilized operating system:
Ubuntu, Debian, or ALT Server:
systemctl restart chrony
Other operating systems:
systemctl restart chronyd
Verify the time synchronization. To do so, execute the command:
chronyc sources -v
If the displayed IP addresses match the addresses of the NTP servers that you specified in the chrony.conf file, synchronization was correctly configured.
Time synchronization between the Squid server and NTP servers will be configured.