centos7配置ntp服务器和客户端同步
环境centos7.6
服务端:ip:172.21.210.27
1、安装ntp、禁用chronyd时间同步服务
yum -y install ntp #安装ntp服务
timedatectl set-ntp 0
2、配置ntp服务器
vi /etc/ntp.conf
restrict default nomodify #去掉后面的 notrap nopeer noquery
restrict 172.21.210.0 mask 255.255.255.0 nomodify notrap #以前是注释的,修改ip段
server 127.127.1.0 #local clock #配置自己为时间同步服务器,注意不是127.0.0.1
fudge 127.127.1.0 stratum 10
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
3、重启服务
systemctl start ntpd && systemctl enable ntpd
客户端同步时间
方式一、ntp模式(一般redhat用)
yum -y install ntp #安装ntp服务
vi /etc/ntp.conf #配置server服务地址
server 172.21.210.27
systemctl start ntpd && systemctl enable ntpd #重启服务
验证:
ntpdate -d 172.21.210.27 #查看同步情况
ntpq -p #查看同步的服务器
ntpstat #查看是否同步
方式二、chronyd方式(一般centos用)
yum -y install chrony
sed -i 's/0.centos.pool.ntp.org/172.21.210.27/' /etc/chrony.conf
验证:
timedatectl
chronyc sources -v #查看时间同步源
做一个决定,并不难,难的是付诸行动,并且坚持到底。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报