Tuesday, May 20, 2025

ALT Linux: Different methods of setting up time synchronization via NTP protocol

Accurate time synchronization is critical for distributed systems, event logging, security, and other tasks. The following NTP (Network Time Protocol) configuration methods are available in ALT Linux: chrony, systemd-timesyncd, ntpd. Before configuring, make sure that other time synchronization services are stopped and disabled.


Configuring Chrony:

Chrony is a modern solution for synchronization with support for unstable networks. In ALT Linux it is enabled by default. To set it up, follow these steps:

1. Install the package, configure autoload and start the service:
sudo apt-get update && sudo apt-get install chrony
sudo systemctl enable --now chronyd


2. Open the file "/etc/chrony.conf" and specify NTP servers or pools:
server ntp1.example.com iburst
server ntp2.example.com iburst


or
pool pool.ntp.org iburst

where:
iburst — speed up initial synchronization;
server — use separate servers;
pool — use a pool of servers.

3. Restart the service:
sudo systemctl restart chronyd

4. Check the status and view the log:
chronyc sources -v
chronyc tracking
journalctl -u chronyd



Configuring systemd-timesyncd:

systemd-timesyncd is a lightweight client integrated into systemd. To configure, follow these steps:

1. Install the package:
sudo apt-get update && sudo apt-get install systemd-timesyncd

2. Enable the service:
sudo timedatectl set-ntp true

3. Edit "/etc/systemd/timesyncd.conf":
[Time]
NTP=ntp1.example.com ntp2.example.com


4. Apply the changes:
sudo systemctl restart systemd-timesyncd

5. Test:
timedatectl show-timesync


Configuring ntpd (legacy method):

NTPd is the classic NTP implementation. To configure this method, follow these steps:

1. Install the package:
sudo apt-get update && sudo apt-get install ntp

2. Edit the configuration file "/etc/ntp.conf":
server ntp1.example.com
server ntp2.example.com


3. Configure autoload and start the service:
sudo systemctl enable ntpd && sudo systemctl start ntpd

4. Perform a check:
ntpq -p

No comments:

Post a Comment