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 set time synchronization in CentOS system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, the editor will bring you about how to set time synchronization in the CentOS system. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Chrony configuration

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:

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

The code is as follows:

Server 0.centos.pool.ntp.org

Server 3.europe.pool.ntp.org

The 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 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 rtcsync-rtcsync instruction enables a kernel mode in which system time is copied to the real-time clock (RTC) every 11 minutes.

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.

The code is as follows:

Allow 192.168.4.5

Deny 192.168/16

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

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.

The code is as follows:

Bindcmdaddress 127.0.0.1

Bindcmdaddress:: 1

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).

Use chronyc

You can also modify the settings by running the chronyc command, which is as follows:

Accheck-check if NTP access is available to a specific host

Activity-this command shows how many NTP sources are online / offline

Add server-add a new NTP server manually.

Clients-reports access to the server at the client

Delete-manually remove a NTP server or peer server

Settime-set daemon time manually

Tracking-displays system time information

You can view the complete list of commands by using the help command:

The above is how to set time synchronization in the CentOS system shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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