Bootstrap FreeKB - Chrony - Configure Chrony on Linux
Chrony - Configure Chrony on Linux

Updated:   |  Chrony articles

This assumes you have already installed Chrony.

The date command can be used to return the current date and time.

date

 

Something like this should be returned.

Mon Jan 01 00:01:01 CDT 2021

 

In the /etc/chrony.conf file, configure the server to allow client PCs in the subnet to connect to the server. In this example, the server is configured to allow PCs in the 192.168.0.0/24 network.

allow 192.168.0.0/24

 

Also ensure the four server directives are not commented out. Replace "distro" with a Linux distro, such as CentOS, Ubuntu, or Fedora.

server 0.distro.pool.ntp.org iburst
server 1.distro.pool.ntp.org iburst
server 2.distro.pool.ntp.org iburst
server 3.distro.pool.ntp.org iburst

 

The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to start and enable chronyd.

systemctl enable chronyd
systemctl start chronyd
systemctl status chronyd

 

If your system is using init, use the chkconfig and service commands to start and enable chronyd.

chkconfig chronyd on
service chronyd start
service chronyd status

 

Use the chronyc sources command to verify that chrony is able to connect to external NTP servers.

chronyc sources

 

Something like this should be returned.

210 Number of sources = 4MS 
Name/IP address   Stratum  Poll  Reach  LastRx  Last sample
=============================================================================
^* example.com             2    10    377     160  +5942us[-1824us] +/-  48ms
^+ example.com             1     8    377     193    -23ms[-  30ms] +/-  56ms
^+ example.com             2    10    377     29m  +6399us[+7465us] +/-  71ms
^+ example.com             2    10    363      49  +6380us[-6380us] +/-  35ms

 

Use the chronyc tracking command to verify that the machine is synchronized.

chronyc tracking

 

If Leap status is “normal”, the machine is synchronized.  On the other hand, if leap status is “not synchronized”, the machine is not synchronized.

Leap status : Normal

 

Use the date command  to verify the server is getting the correct date and time from the NTP pool.

Mon Jan 01 08:30:01 CDT 2021

 

And the timedatectl command should return something like this.

AVOID TROUBLE

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

~]# timedatectl
      Local time: Mon 2020-12-07 06:51:29 CST
  Universal time: Mon 2020-12-07 12:51:29 UTC
        RTC time: Mon 2020-12-07 12:51:30
       Time zone: America/Winnipeg (CST, -0600)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2020-11-01 01:59:59 CDT
                  Sun 2020-11-01 01:00:00 CST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2021-03-14 01:59:59 CST
                  Sun 2021-03-14 03:00:00 CDT

 

It is important to recognize that some time zones use both Standard Time and Daylight Savings Time. In the prior output, the date and time is in Central Daylight Time (CDT). When Daylight Savings Time is not being observed, the date and time should be in Central Standard Time (CST). In this time zone, CDT is 5 hours behind Coordinated Universal Time (UTC), and CST is 6 hours behind Coordinated Universal Time (UTC). Daylight Savings Time is generally observed from early March to early November, and Standard Time is generally observed from early November to early March.

Other computers can now use the Chrony server for time management.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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