chrony服务器

目录

1.chrony简介

2.chrony安装配置

[2.1 chrony安装及配置](#2.1 chrony安装及配置)

非常重要:在配置之前,检查防火墙和selinux是否关闭

3.将chrony配置为其他主机的时间服务器

[3.1 修改chrony配置文件](#3.1 修改chrony配置文件)

4.chronyc命令

1.chrony****简介

chrony 是开源的遵循网络时间协议( ntp )的软件,让计算机系统时间与时间服务器时间一致, chrony
也可以作为时间服务器为其他主机提供服务。
ntp (网络时间协议):是 udp 的 123 端口。 chrony 和 ntp 在一个计算机中只能存在一个。

2.chrony****安装配置

2.1 chrony****安装及配置

非常重要:在配置之前,检查防火墙和selinux是否关闭

复制代码
yum install -y chrony
vim /etc/chrony.conf
[root@localhost ~]# cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server ntp.aliyun.com iburst (编写的网络时间服务器)
[root@localhost ~]# systemctl enable chronyd
[root@localhost ~]# systemctl enable chronyd
[root@localhost ~]# timedatectl status
Local time: Thu 2023-07-27 10:03:39 CST
Universal time: Thu 2023-07-27 02:03:39 UTC
RTC time: Thu 2023-07-27 02:03:39
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes (两个为yes即可)
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

3.chrony****配置为其他主机的时间服务器

3.1修改chrony****配置文件

复制代码
在提供chrony时间服务器主机的chrony配置文件中修改以下地方
服务端
1.# Allow NTP client access from local network.
allow 192.168.27.0/24(开启指定ntp客户端)
2.# Serve time even if not synchronized to a time source.
local stratum 10
3.systemctl restart chronyd
客户端
1.下载安装chrony服务
2.编写chrony配置文件
vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.27.120 iburst (ip是提供时间服务器的ip)
3.systemctl enable chronyd
systemctl start chronyd
检查是否同步成功
timedatectl status

4.chronyc****命令

查看 ntp services
结果查看
^* :代表的是时间同步正常,同步的时间源可用
^- :代表的是可接受的源
^? :时间同步的源是不可到达的
查看 ntp serveices 是否在线
查看 ntp 的详细信息

复制代码
[root@localhost ~]# chronyc activity -v
200 OK

[root@localhost ~]# chronyc tracking -v
相关推荐
SelectDB4 小时前
Litefuse 开源并推出单进程轻量模式,25 秒就能跑起来的 Agent 可观测与评估平台
运维·后端·自动化运维
zzzzzz3102 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode2 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
用户0328472220702 天前
如何搭建本地yum源(上)
运维
大树885 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
摇滚侠5 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
霸道流氓气质5 天前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务
小宇宙Zz5 天前
Maven依赖冲突
java·服务器·maven
Inhand陈工5 天前
基于台达PLC与映翰通IG502的智慧水产养殖精准投喂与远程运维解决方案
运维·人工智能·物联网·阿里云·信息与通信
酣大智5 天前
ARP代理--工作原理
运维·网络·arp·arp代理