Linux 使用 chrony 进行 NTP 时间同步及自建方法

简介: chrony是网络时间协议的实现。它可以替代ntpd,后者是NTP的参考实现。它在类Unix操作系统上运行,并在GNU GPL v2下发布。

chrony是网络时间协议的实现。它可以替代ntpd,后者是NTP的参考实现。它在类Unix操作系统上运行,并在GNU GPL v2下发布。

服务端和客户端配置文件都是同一个,分别配置为服务器和客户端即可使用,
配置文件在 /etc/chrony.conf or /etc/chrony/chrony.conf ,具体看版本,
可以使用 man chrony 确认一下。

服务端配置

服务端配置:

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server s1a.time.edu.cn iburst
server ntp.aliyun.com iburst

# Allow NTP client access from local network.
allow 192.168.8.0/24

开启同步

systemctl enable chronyd
systemctl restart chronyd

# 查看时间同步状态
timedatectl status
# 开启网络时间同步
timedatectl set-ntp true

客户端配置

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.8.5 iburst

# Allow NTP client access from local network.

开启同步

systemctl enable chronyd
systemctl restart chronyd

# 查看时间同步状态
timedatectl status
# 开启网络时间同步
timedatectl set-ntp true

常用命令

# 查看 ntp_servers
chronyc sources -v

# 查看 ntp_servers 状态
chronyc sourcestats -v

# 查看 ntp_servers 是否在线
chronyc activity -v

# 查看 ntp 详细信息
chronyc tracking -v

参考文献

目录
相关文章
|
4月前
|
Linux 网络安全 开发工具
linux 时间同步 chrony
linux 时间同步 chrony
195 1
|
10月前
|
监控 Linux 定位技术
suse 12 部署chrony时间同步服务器
suse 12 部署chrony时间同步服务器
209 0
|
安全 Linux 网络安全
Linux 时间同步 -NTP 服务器
本文主要介绍如何配置 Linux 服务器集群的时间同步,技术实现上使用 NTP 服务器和客户端同步时间。
512 0
|
Linux 开发工具
Linux下快速搭建ntp时间同步服务器(转载:http://www.linuxidc.com/Linux/2014-07/104371.htm)
背景: 服务器多了,时间是否一致以及是否准备就显得格外重要,虽然这个问题总是被忽略,但是统一时间是很有必要的,因为时间问题导致服务出现问题也是司空见惯,本文简单介绍Linux下ntp的快速搭建和使用。 CentOS NTP服务器安装与配置 http://www.linuxidc.com/Linux/2014-01/95258.htm Linux实战部署系列之NTP服务器 http://www.
2785 0
|
Linux 定位技术 Windows
linux时间同步,ntpd、ntpdate
linux时间同步,ntpd、ntpdate 在Windwos中,系统时间的设置很简单,界面操作,通俗易懂。而且设置后,重启,关机都没关系。系统时间会自动保存在Bios的时钟里面,启动计算机的时候,系统会自动在Bios里面取硬件时间,以保证时间的不间断。
3107 0
|
Linux 开发工具 网络安全
|
Linux 虚拟化 数据安全/隐私保护