In Linux, Network Time Protocol (NTP) is the protocol used to synchronize the system clock with a remote server.
NTP(Network time Protocol):
Validate if NTP is active by running below command, which provide output of current time, UTC time etc.
$ timedatectl
Example output:
$ timedatectlLocal time: Sat 2024-08-10 13:32:19 CDTUniversal time: Sat 2024-08-10 18:32:19 UTCRTC time: Sat 2024-08-10 18:32:19Time zone: America/Chicago (CDT, -0500)System clock synchronized: yesNTP service: activeRTC in local TZ: no
If NTP is not activie, enable as below
$ sudo timedatectl set-ntp true$ view /var/log/syslog | grep ntp
Install NTP client: An NTP client is a software component that synchronizes a computer’s clock with a reference time source, typically an NTP server. The client periodically requests the current time from the server and adjusts its local clock accordingly.
$ sudo apt install ntpdate$ sudo apt install ntp
Verify: $ ntpstat, $ntpq -p
Sync time with Chrony:
Install as below
$ sudo apt install chronyor$ sudo yum install chronyVerify By:$ sudo service chronyd statusIn RHEL7: vi /etc/chrony.confIn RHEL6: VI /etc/ntp.conf
Some use full chronyc commands
1) For tracking
$ chronyc tracking
2) To know sync sources
$ chronyc sources
$ chronyc sources -v
3) To know stats
$ chronyc sourcestat
Summary:
NTP, chrony, openntpd are implementations of the Network Time Protocol (NTP).
Chrony is more modern with improved timestamping, authentication and encrypting. It has smaller code size and lightweight than NTP and is default in RHEL variants.
NTP is traditional implementation and has larger code size and more resource intensive.
Openntpd is another implementation.
***
No comments:
Post a Comment