Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure Chrony on Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install and configure Chrony on Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install and configure Chrony on Linux.

Chrony client

Chrony is an alternative to the NTP client. It can synchronize clocks with more accurate time and faster speed, and it is very useful for systems that are not online 24 / 7.

Chronyd is smaller, more energy efficient, takes up less memory and wakes up CPU only when needed. Even if the network is congested for a long time, it can run well. It supports hardware timestamps on Linux and allows extremely accurate synchronization on the local network.

It provides the following two services.

The command line interface of chronyc:Chrony.

Chronyd:Chrony daemon service.

How do I install and configure Chrony on Linux?

Since the installation package is available in the official repository of most distributions, use the package manager directly to install it.

For Fedora systems, use the DNF command to install chrony.

$sudo dnf install chrony

For Debian/Ubuntu systems, use the APT-GET command or the APT command to install chrony.

$sudo apt install chrony

For Arch Linux-based systems, use the Pacman command to install chrony.

$sudo pacman-S chrony

For RHEL/CentOS systems, use the YUM command to install chrony.

$sudo yum install chrony

For openSUSE Leap systems, use the Zypper command to install chrony.

$sudo zypper install chrony

In this article, we will use the following settings to test.

NTP server: hostname: CentOS7.2daygeek.com,IP:192.168.1.5,OS:CentOS 7

Chrony client: hostname: Ubuntu18.2daygeek.com,IP:192.168.1.3,OS:Ubuntu 18.04

For server installation, visit the URL where the NTP server is installed and configured on Linux.

I have installed and configured the NTP server on the host CentOS7.2daygeek.com, so attach it to all client machines. In addition, other required information is included.

The location of the chrony.conf file varies depending on your distribution.

For RHEL-based systems, it is located at / etc/chrony.conf.

For Debian-based systems, it is located at / etc/chrony/chrony.conf.

# vi / etc/chrony/chrony.conf server CentOS7.2daygeek.com prefer iburstkeyfile / etc/chrony/chrony.keysdriftfile / var/lib/chrony/chrony.driftlogdir / var/log/chronymaxupdateskew 100.0makestep 1 3cmdallow 192.168.1.0/24

The Chrony service needs to be restarted after updating the configuration.

For sysvinit systems. RHEL-based systems need to run chronyd instead of chrony.

# service chronyd restart# chkconfig chronyd on

For systemctl systems. RHEL-based systems need to run chronyd instead of chrony.

# systemctl restart chronyd# systemctl enable chronyd

Use subcommands such as tacking, sources, and sourcestats to check the synchronization details of chrony.

To check the tracking status of chrony.

# chronyc trackingReference ID: C0A80105 (CentOS7.2daygeek.com) Stratum: 3Ref time (UTC): Thu Mar 28 05:57:27 2019System time: 0.000002545 seconds slow of NTP timeLast offset: + 0.001194361 secondsRMS offset: 0.001194361 secondsFrequency: 1.650 ppm fastResidual freq: + 184.101 ppmSkew: 2.962 ppmRoot delay: 0.107966967 secondsRoot dispersion: 1.060455322 secondsLeap status: Normal

Run the sources command to display information about the current time source.

# chronyc sources210 Number of sources = 1MS Name/IP address Stratum Poll Reach LastRx Last sample==== ^ * CentOS7.2daygeek.com 2 6 17 62 + 36us [+ 1230us] + /-1111ms

The sourcestats command displays information about the drift rate and offset estimation process for each source that chronyd is currently checking.

# chronyc sourcestats210 Number of sources = 1Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev====CentOS7.2daygeek.com 5 3 71-97.314 78.754-469us 441us

When chronyd is configured as a NTP client or peer, you can send / receive timestamp mode and interlaced mode reports to each NTP source through the chronyc ntpdata command.

# chronyc ntpdata Remote address: 192.168.1.5 (C0A80105) Remote port: 123Local address: 192.168.1.3 (C0A80103) Leap status: NormalVersion: 4Mode: ServerStratum: 2Poll interval: 6 (64 seconds) Precision:-23 (0.000000119 seconds) Root delay: 0.108994 secondsRoot dispersion: 0.076523 secondsReference ID: 85F3EEF4 () Reference time: Thu Mar 28 06:43:35 2019Offset : + 0.000160221 secondsPeer delay: 0.000664478 secondsPeer dispersion: 0.000000178 secondsResponse time: 0.000243252 secondsJitter asymmetry: + 0.00NTP tests: 1111111111Interleaved: NoAuthenticated: NoTX timestamping: KernelRX timestamping: KernelTotal TX: 46Total RX: 46Total valid RX: 46

Run the date command.

# dateThu Mar 28 03:08:11 CDT 2019

To immediately follow the system clock and bypass any ongoing slow adjustments, run the following command as root (to manually adjust the system clock).

# chronyc makestep Thank you for reading, the above is the content of "how to install and configure Chrony on Linux". After the study of this article, I believe you have a deeper understanding of how to install and configure Chrony on Linux, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report