I come from the Ubuntu context: there installing a package named kind of
ntp was generally enough to ensure time synchronization. Today I performed another of my early Rocky Linux installations and I suspect I unintentionally skipped setting an option that would bring that functionality with no other action required. Installing afterwards a package name
chrony didn’t help. I might have some firewall between the machine and the external NTP servers, though apparently the first time I installed this matter went smoothly - I did not find the clock set at a presumably GMT time.
How would you achieve such a result?
Thanks in advance!
Chrony uses port udp/323 whereas ntp uses udp/123. So if your firewall does block chrony, then you would need to unblock outgoing access for udp/323.
You can use as an alternative
dnf install systemd-timesyncd
which apparently will use ntp and therefore udp/123. You will of course then need to disable chrony service or remove it, and then enable the systemd-timesyncd service and start it.
I’ve hastily read something about chrony and I may sum up as below.
Setting up a chronyd service is the right way to have an automatic synchronization with no need to invoke it with a command line client
The mentioned configuration does not imply automatically handling a time server for other hosts
Can you confirm?
After installing make sure your chrondyd service is running by ( systemctl status chronyd.service)
If service is running check whether client is able to sync time
# chronyc -n sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
^- 22.214.171.124 2 10 377 98 -157us[ -161us] +/- 2961us
^- 126.96.36.199 2 10 377 98 +10us[+6011ns] +/- 2928us
^- 188.8.131.52 2 10 371 427 -363us[ -368us] +/- 49ms
^- 184.108.40.206 2 10 336 23m +855us[ +866us] +/- 43ms
^* 169.254.169.123 3 4 377 9 -4524ns[-5179ns] +/- 424us
Asterisk showing the server with whom client is currently syncing.
Value under Reach column is important. Its should be 377 ( This is in octal , In binary it will be converted to 11111111 ) which literally display the information about last 8 times syncing status ( 1 mean it was successful and 0 mean get failed due to some reason )
Chrony will not change your time zone. If you need to set time zone . you may set by
timedatectl set-timezone Asia/Dubai
you may get the full availbe time zone list by