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
相关推荐
abigriver4 小时前
打造 Linux 离线大模型级语音输入法:Whisper.cpp + 3090 显卡加速与 Rime 中英混输终极调优指南
linux·运维·whisper
wangqiaowq4 小时前
windows下nginx的安装
linux·服务器·前端
charlie1145141915 小时前
嵌入式Linux驱动开发pinctrl篇(1)——从寄存器到子系统:驱动演进之路
linux·运维·驱动开发
Agent手记5 小时前
异常考勤智能预警与处理与流程优化方案 | 基于企业级Agent的超自动化实战教程
运维·人工智能·ai·自动化
cen__y6 小时前
Linux12(Git01)
linux·运维·服务器·c语言·开发语言·git
189228048618 小时前
NY352固态MT29F32T08GWLBHD6-24QJ:B
大数据·服务器·人工智能·科技·缓存
AI视觉网奇8 小时前
linux 检索库 判断库是否支持
java·linux·服务器
dapeng-大鹏8 小时前
KVM+LVM 零停机在线扩容 Ubuntu 根分区:从磁盘添加到逻辑卷扩展完整
linux·运维·ubuntu·磁盘空间扩展
乐维_lwops8 小时前
案例解读|运维监控助力某大型卷烟厂构建高效运维监控体系
运维·运维案例
JiaWen技术圈8 小时前
网站用户注册行为验证码方案
运维·安全