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 deploy a chrony server

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Brief introduction

Chrony is an open source free software that helps you keep your system clock in sync with your clock server (NTP), thus keeping your time accurate. It consists of two programs, chronyd and chronyc. Chronyd is a daemon running in the background that adjusts the synchronization of the system clock running in the kernel with the clock server. It determines the ratio of the increase or decrease of time by the computer and compensates for it. Chronyc provides a user interface for monitoring performance and diversified configurations. It can work on a computer controlled by an chronyd instance or on a different remote computer.

Configuration file 1.server-this parameter can be used multiple times to add a clock server and must be used in "server" format. Generally speaking, you can add as many servers as you want.

The 2.stratumweight-stratumweight directive sets how much distance each layer should add to the synchronization distance when chronyd selects a synchronization source from the available sources. By default, CentOS is set to 0 to have chronyd ignore the level of the source when selecting the source.

One of the main behaviors of the 3.driftfile-chronyd program is to calculate the ratio of the increase and decrease of the computer time according to the actual time, and it is most reasonable to record it in a file. It will compensate the system clock after restart and, if possible, get a better valuation from the clock server.

The 4.rtcsync-rtcsync instruction enables a kernel mode in which system time is copied to the real-time clock (RTC) every 11 minutes.

5.allow / deny-here you can specify a host, subnet, or network to allow or deny NTP to connect to the machine that acts as the clock server.

Deny 192.168/16

6.cmdallow / cmddeny-similar to the above, except that you can specify which IP address or which host can use the control command through chronyd

7.bindcmdaddress-this instruction allows you to restrict which network interface chronyd listens on (executed by chronyc). This directive provides an additional level of access control available in addition to the above restrictions through the cmddeny mechanism.

Bindcmdaddress:: 1

8.makestep-typically, chronyd will cause the system to gradually correct all time deviations by slowing down or accelerating the clock as needed. In certain cases, the system clock may drift too fast, causing the adjustment process to take a long time to correct the system clock. This directive forces chronyd to step through the system clock when the adjustment period is greater than a certain threshold, but only if there are no more clock updates because the chronyd-startup time exceeds the specified limit (negative values can be used to disable the limit).

When Chrony starts, it reads the settings in the / etc/chrony.conf configuration file. The most important settings on the CentOS 7 operating system are:

Allow 192.168.4.5

Bindcmdaddress 127.0.0.1

Steps

1. Install Chrony,CentOS 7 by default

Yum install chrony-y

2. Modify Chrony configuration file

Vim / etc/chrony.conf

# comment out the external time server that comes with the configuration

# server 0.centos.pool.ntp.org iburst

# server 1.centos.pool.ntp.org iburst

# server 2.centos.pool.ntp.org iburst

# server 3.centos.pool.ntp.org iburst

# add available NTP servers, such as Beijing University of posts and Telecommunications, National time Service Center and Aliyun Public Network NTP

Server 202.112.10.60 iburst

Server ntp.ntsc.ac.cn iburst

Server ntp1.aliyun.com iburst

# allow devices of these network segments to synchronize time, allow... Commenting out means allowing any device

# Allow NTP client access from local network

Allow 192.168.0.0/16

3. Service settings

# restart chronyd service

Systemctl restart chronyd

# View the status of chronyd service

Systemctl status chronyd

# set chronyd to boot

Systemctl enable chronyd

4. Check the synchronization

Chronyc sources-v

II. Client settings

1. Install Chrony,CentOS 7 by default

Yum install chrony-y

2. Modify Chrony configuration file

Vim / etc/chrony.conf

# comment out the time server that comes with the configuration

# server 0.centos.pool.ntp.org iburst

# server 1.centos.pool.ntp.org iburst

# server 2.centos.pool.ntp.org iburst

# server 3.centos.pool.ntp.org iburst

# sever add chrony server as ntp server

Server xxx.xxx.xxx.xxx iburst

3. Service settings

# restart chronyd service

Systemctl restart chronyd

# View the status of chronyd service

Systemctl status chronyd

# set chronyd to boot

Systemctl enable chronyd

4. Check the synchronization

Chronyc sources-v

PS: chrony and ntpd cannot be enabled at the same time due to port conflicts

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