In this Article, you will learn how to synchronize and configure time in Linux with chrony and “timedatectl” tool.

May 02, 2018 Microsoft Windows Server 2008, Server 2003. Change the server type to NTP. Registry Key: HKEYLOCALMACHINE SYSTEM CurrentControlSet Services W32Time Parameters Type. Change value data to. Set announce flags. Registry Key. NAME ntpdate - set the date and time via NTP ntpdate sets the local date and time by polling the Network Time Proto‐ col (NTP) server(s) given as the server arguments to determine the cor‐ rect time. It must be run as root on the local host (unless the option -q is used).

Contents

  • UNDERSTANDING THE SUBJECT MATTER
    • ACTION TIME

UNDERSTANDING THE SUBJECT MATTER

The correctness of time in an Operating system is very important, especially if it is a log system/server that has to do with tracking of various logs and activities at a particular time, correct timing, in this case, is essential. More so, systems that are used in Financial or government sectors cannot afford not to have the correct time set. Hence the time of these particular sets of systems and their likes must be correct and well synchronized at all times.

A virtualization Engineer who configures clustering and High availability services can tell how important all the systems that will be clustered must have the same time and must be synchronized at all times to avoid malfunction of a clustered environment.

In most operating systems, Linux inclusive, correct timing can be done with the use of NTP (Network Time Protocol) services.

Network time protocol (NTP) is a protocol that is used to automatically synchronize time over a network. NTP is server/client based, whereby NTP servers are sitting somewhere as a pool of servers in different zones and regions and NTP client will be configured on a Linux system to synchronize time from an NTP server.

There are a few numbers of NTP server pool, a Linux OS by default knows how to use the one closer to the region that is selected during the installation of the operating system. Some clustered environment prefers to have an internal central NTP server configured so that other systems in the environment will synchronize time from it.

In old distributions of RHEL servers and some other distributions, the ntpd daemon with the “ntpdate” tool is the client that is used to synchronize the time of a Linux system over a network from the NTP server, but in newer versions of RHEL and some other distributions, “ntpdate” tool /ntpd daemon has been deprecated and the new NTP client responsible for NTP time synchronization from the NTP server is chrony. The chronyd daemon must be up and running on the system before there can be synchronization.

There have been a lot of controversial discussions as regards why ntp was joined with chrony in RHEL 7 and finally deprecated in RHEL 8. Some agreed ntp is better than chrony in many ways while some disagreed. Well, you may drop your perspective in the comment section. It is not a doubt that there are differences between the two even if their configuration files are almost similar,You may want to click the link below to check their differences.

Moving forward, since chrony is the new NTP client, we are going to go through the step by step process of how to use “chrony” to synchronize time, and use the “timedatectl” utility to configure time in the ACTION TIME” section.

Before we roll down to the “ACTION TIME” section, let’s understand the chrony configuration file.

The chrony configuration file can be found in the path “/etc/chrony.conf” on a RHEL 7/8 server and some other distributions and can be seen after chrony is installed.

  • Number 1 is the NTP server (“pool 2.rhel.pool.ntp.org iburst”), i.e, the server the NTP client will synchronize from.
  • Number 2 means that the kernel synchronization of the real-time clock is enabled. To disable it, comment the parameter “rtcsync”.
  • Number 3 means that NTP clients will not be synchronized from the local network. If you want chrony to work without a network connection, you can uncomment the parameter, and the system can be manually synchronized. This is also a way of configuring the system to be an NTP server and other systems can synchronize provided their configuration files are set to synchronize from this subnet.

After synchronization of time from NTP server has been done, you may want to use the command below to set the system hardware clock

For more usage of the of the hwclock utility, refer to the hwclock manual page.

  • Number 4 means the security key for NTP authentication will be in the (/etc/chrony.keys) location by default.
  • Number 5 means NTP service log files will be in the (/var/log/chrony) location by default.

Please note, time configuration in Linux can be and not be simple, so if you don’t know what you are doing, don’t tamper with the chrony configuration file. Just leave it as it is.

Installation of chrony comes with the chronyc tool as well. The chronyc tool is the CLI for chrony and can be used to interact and make changes to chrony. we will use this tool in the “ACTION TIME” section.

ACTION TIME

How To Configure/Synchronize Time With Chrony On RHEL 7/8 System

1. Install chrony

If chrony is not installed on your distribution, use the command below to install chrony.

By default, chrony is installed on RHEL/CentOS 7 & 8 systems

2. Verify if the service is running.

3. Start the service if it is not running and enable the service.

4. Verify the current time and NTP status using “timedatectl” utility.

5. Activate the NTP service with “timedatectl” utility

6. Verify if the NTP service has started by checking the status of chronyd service

7. Verify the current time and NTP status again using “timedatectl” utility.

8. Get the current time zones

9. Set the time to your desired time zone using the command

For example, to set the time zone to Africa, Cairo, use the command,

10. Verify the current time.

Linux Ntp Sync

Synchronize

Synchronize Time With Ntp Server Ip

How To Manually Synchronize Time With NTP Server In Linux Using Chrony

How To Synchronize Time With Ntp Server

To manually synchronize time, use the command

As explained in “UNDERSTANDING THE SUBJECT MATTER, in my case, my NTP server is ” pool 2.rhel.pool.ntp.org iburst” , therefore, I will use the command,

. Manufacturer's Suggested Retail PriceDisclaimer: Glass's Information Services (GIS) and Carsguide Autotrader Media Solutions Pty Ltd. Our database has the answer.Everything you need to know to keep you and your family as safe as possible.Helpful advice before you finance your next car.Tips for getting the right insurance and how to make a claim.Everything you need to know when sizing up your new car. (carsguide) provide this information based on data from a range of sources including third parties. Ford econovan service manual download.

How To Verify If There Is synchronization With chronyc

To verify if there is synchronization with chronyc tool, use the command,

How To Verify Chrony Sources WIth chronyc tool

To verify the current time source, use the command,

For more detailed source listing, use the command,

Synchronize Time With Ntp Server Download

Tutorial Video On How To Synchronize / Configure Time In Linux

Failed To Synchronize Time With Ntp Server

Your feedback is welcomed. If you love others, you will share with others