时间同步服务器搭建

1.设定实验环境

时间同步服务器:

IP:172.25.254.100

火墙:关闭

root@node1 \~# systemctl disable --now firewalld #关闭防火墙

root@node1 \~# systemctl mask firewalld #锁定

Created symlink /etc/systemd/system/firewalld.service → /dev/null.

客户端:

IP:172.25.254.200

火墙:不做要求

确保此主机能和172.25.254.100通信

ping 172.25.254.100 #测试两台机器是否能够通信

2.配置时间同步服务器服务端

在172.25.254.100主机中

安装服务

root@node1 \~# dnf install chrony -y

正在更新 Subscription Management 软件仓库。

无法读取客户身份

本系统尚未在权利服务器中注册。可使用 "rhc" 或 "subscription-manager" 进行注册。

上次元数据过期检查:0:30:22 前,执行于 2026年07月16日 星期四 14时18分20秒。

软件包 chrony-4.6.1-1.el9.x86_64 已安装。

依赖关系解决。

无需任何处理。

完毕!

编写时间服务器配置文件

root@node1 \~# vim /etc/chrony.conf

#pool 2.rhel.pool.ntp.org iburst

Allow NTP client access from local network.

allow 0.0.0.0/0 #放宽条件

Serve time even if not synchronized to a time source.

local stratum 10

root@node1 \~# systemctl stop chronyd.service #暂停时间同步服务

root@node1 ~]# timedatectl set-time "2026-11-11 11:11:11" #设定时间,后续客户端需同步此时间

root@node1 \~# timedatectl #查看是否修改成功

Local time: 三 2026-11-11 11:11:14 CST

Universal time: 三 2026-11-11 03:11:14 UTC

RTC time: 三 2026-11-11 03:11:14

Time zone: Asia/Shanghai (CST, +0800)

System clock synchronized: no

NTP service: inactive

RTC in local TZ: no

root@node1 \~# systemctl start chronyd #开启时间同步服务

在客户端测试

root@node2 \~# dnf install chrony -y

root@node2 \~# vim /etc/chrony.conf

pool 172.25.254.100 iburst

root@node2 \~# systemctl restart chronyd

root@node2 \~# chronyc sources -v

.-- Source mode '^' = server, '=' = peer, '#' = local clock.

/ .- Source state '*' = current best, '+' = combined, '-' = not combined,

| / 'x' = may be in error, '~' = too variable, '?' = unusable.

|| .- xxxx yyyy +/- zzzz

|| Reachability register (octal) -. | xxxx = adjusted offset,

|| Log2(Polling interval) --. | | yyyy = measured offset,

|| \ | | zzzz = estimated error.

|| | | \

MS Name/IP address Stratum Poll Reach LastRx Last sample

===============================================================================

^* 172.25.254.100 10 6 17 7 +5972ns+1668ns +/- 119us

root@node2 \~# date

2026年 11月 11日 星期三 11:12:25 CST

相关推荐
zhikouai29 分钟前
把外部助手接进聊天软件的架构分层与参数配置
服务器·网络·php
huainingning32 分钟前
锐捷10.X路由器版本升级不生效问题排查
运维·网络·智能路由器
荣合技术服务1 小时前
HPC 超算集群故障维修实录:找荣合科算维护后,模拟仿真计算又能跑了
运维·服务器·超算服务器·荣合科算
AR-26710-4 小时前
Linux Day31——实操启停服务改端口重启
linux·运维
百度Geek说4 小时前
QCon上海2026:百度 SRE Agent 规模化落地实践解读
运维·自动化运维
叼烟扛炮4 小时前
Linux 学习笔记(五十八):IO 多路复用封神——epoll 底层原理揭秘
linux·运维·服务器·网络·笔记·学习·php
星恒随风5 小时前
Linux网络编程:彻底理解IO多路复用select!从fd_set位图、读写就绪到手写TCP多客户端字典服务器
linux·服务器·网络
分布式存储与RustFS7 小时前
给 RustFS 桶加一层内存缓存:用 Alluxio 让热数据少跑一遍网络
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
Oiiouui8 小时前
linux服务器部署Logto后端与对应前端的实现
linux·服务器·前端·后端