FreeKB - Chrony get time from a Chrony server
Chrony - get time from a Chrony server

In this tutorial, we will configure one of our Linux machines to get time from a local Chrony network time protocol (NTP) server.

PIng the Chrony server to ensure the client can communicate with the Chrony server.

~]# ping -c4 ntp.example.com
64 bytes from ntp.example.com (192.168.0.3): icmp_seq=1 ttl=64 time=0.321 ms
64 bytes from ntp.example.com (192.168.0.3): icmp_seq=2 ttl=64 time=0.234 ms
64 bytes from ntp.example.com (192.168.0.3): icmp_seq=3 ttl=64 time=0.261 ms
64 bytes from ntp.example.com (192.168.0.3): icmp_seq=4 ttl=64 time=0.306 ms

 

Install Chrony on the client.

In the /etc/chrony.conf file, comment out the 4 pool NTP pool servers, and then add server ntp_server (example: server ntp.example.com). This configures the client to use the local NTP servers for time.

server ntp1.example.com iburst
server ntp2.example.com iburst

 

Restart and enable the chronyd service.

systemctl restart chronyd
systemctl enable chronyd
systemctl status chronyd

 

Use the chronyc sources command to verify that the changes made to the /etc/chrony.conf file have taken effect. The hostname of your local Chrony server should be displayed.

[root@server1 ~]# chronyc sources
210 Number of sources = 4MS Nmae/IP address   Stratum  Poll  Reach  LastRx  Last sample
==============================================================================
? ntp.example.com         2    10    377     160  +5942us[-1824us] +/-  48ms

 

Use the chronyc tracking command to verify that the client is synchronized with your local Chrony server.  If Leap status is “Normal”, you are synchronized.   After editing the /etc/chrony.conf file, it can take a few minutes for the client to synchronize with the NTP server.

AVOID TROUBLE

Do not be thrown off by the Ref time (UTC). This is universal time, not local time.

[root@server1 ~]# chronyc tracking
Reference ID    : C0A80008 (ntp1.software.eng.us)
Stratum         : 3
Ref time (UTC)  : Fri Aug 27 12:15:32 2021
System time     : 0.000000046 seconds fast of NTP time
Last offset     : -0.000043982 seconds
RMS offset      : 0.000166799 seconds
Frequency       : 10.759 ppm slow
Residual freq   : -0.141 ppm
Skew            : 0.556 ppm
Root delay      : 0.072958604 seconds
Root dispersion : 0.002349269 seconds
Update interval : 64.7 seconds
Leap status     : Normal

 

Use the timedatectl command to verify that "NTP enabled" and "NTP synchronized" both return "yes", and that the time and time zone is correct.

AVOID TROUBLE

Do not be thrown off by the Univeral time (UTC) and RTC time. These will always be different than local time.

[root@server1 ~]# timedatectl
       Local time: Fri 2021-08-27 07:14:22 CDT
   Universal time: Fri 2021-08-27 12:14:22 UTC
         RTC time: Fri 2021-08-27 12:14:22
        Time zone: America/Chicago (CDT, -0500)
NTP enabled      : yes
NTP synchronized : yes


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter d4120 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |