Chrony - 一步搞定NTP时间同步问题
什么是chrony?
A client/server for the Network Time Protocol, this program keeps your computer’s clock accurate. It was specially designed to support systems with intermittent internet connections, but it also works well in permanently connected environments. It can use also hardware reference clocks, system real-time clock or manual input as time references.
chrony是一个ntp协议的实现程序,既可以当做服务端,也可以充当客户端;它专为间歇性互联网连接的系统而设计,当然也能良好应用于持久互联网连接的环境;chrony有三个时间参考:硬件时钟、实时时钟以及手动同步。
chrony的程序环境
主配置文件:/etc/chrony.conf
客户端程序:/usr/bin/chronyc
服务端程序:/usr/sbin/chronyd
为本地服务器配置一个时间服务器
环境
时间服务器:192.168.1.10
允许本网段192.168.1.0/24同步时间。
配置服务端
在编辑配置文件之前,我一般习惯于备份一下,以备重新调整。
网络时间服务器可以自行查找,网上很多资料,下边配置两个个国内常用的时间服务器:
1 |
|
1 |
|
1 |
|
客户端同步
配置192.168.1.10作为时间服务器
1 |
|
进入chronyc客户端交互式模式:~]# chronyc
查看现有的时间服务器
1 |
|
查看时间服务器状态
1 |
|
也可以直接在命令行使用:
1 |
|
chrony兼容ntpdate,客户端可以使用ntpdate手动同步时间
1 |
|
Chrony - 一步搞定NTP时间同步问题
http://maitianxin.github.io/2019/09/24/linux/chrony/