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.

Use the timedatectl command to verify that NTP is not enabled, you are not synchronized with your Chrony server, and that the local time may be incorrect.

[root@server1 ~]# timedatectl
Local time       : Mon 2016-01-01 00:01:01 CDT
. . .
NTP enabled      : yes
NTP synchronized : yes

 

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

[root@server1 ~]# 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 (refer to How to install Chrony).

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

#server 0.distro.pool.ntp.org iburst
#server1.distro.pool.ntp.org iburst
#server2.distro.pool.ntp.org iburst
#server3.distro.pool.ntp.org iburst
peer ntp.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 NTP server should have a collection of external NTP servers. The client machines should only display the IP address of the internal NTP server.

[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 both VMs are synchronized.  If Leap status is “normal”, you are synchronized.  On the other hand, if leap status is “not synchronized”, you are not synchronized. After editing the /etc/chrony.conf file, it can take a few minutes for the client to synchronize with the NTP server.

[root@server1 ~]# chronyc tracking
. . .
Leap status : Normal

 

Use the timedatectl command to verify that NTP is enabled, you are synchronized with your local NTP server, and that the local time is correct.

[root@server1 ~]# timedatectl
Local time       : Mon 2016-01-01 00:01:01 CDT
. . .
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 b3443 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   |