检查服务
rpm -qa | grep ntp
ntpdate-4.2.6p5-1.el6.x86_64
fontpackages-filesystem-1.41-1.1.el6.noarch
ntp-4.2.6p5-1.el6.x86_64
如果没有ntp删除ntpdate
yum –y remove ntpdateXXXXXXXXXXX
yum –y install ntp
修改所有节点
vi /etc/ntp.conf
restrict 此节点ip nomodify notrap nopeer noquery
restrict 网关 mask 子网掩码 nomodify notrap
server 主节点ip
Fudge 主节点ip stratum 10
主节点
server 127.127.1.0
Fudge 127.127.1.0 stratum 10
需要同步硬件时间
vi /etc/sysconfig/ntpd
添加SYNC_HWCLOCK=yes
手动同步hwclock -w
启动ntp
systemctl start ntpd
开机启动
systemctl enable ntpd
查看状态
ntpstat
主节点:
synchronised to local net (127.127.1.0) at stratum 6
time correct to within 11 ms
polling server every 64 s
从节点:
synchronised to NTP server (10.95.107.225) at stratum 7
time correct to within 38 ms
polling server every 256 s
查看已存在ntp服务器信息
ntpq -p
+优先*次之 层数 上一次同步 下一次 总次数 延迟 补偿时间 时间差
remote refid st t when poll reach delay offset jitter
==============================================================================
*(+)主节点ip LOCAL(0) 6 u 5 64 77 0.055 2.356 0.438
ntpd与ntpdate不能同时运行二者改变时间方式不一样ntpd平滑改变(有时间间隔)ntpdate跳跃改变(立刻同步)
ntp服务
原文:https://www.cnblogs.com/caienen/p/12192021.html