1、安装ntf服务器
yum –y ×××tall ntpapp
2、配置ntp服务
1)修改全部节点的/etc/ntp.confide
vi /etc/ntp.conf
restrict 172.18.74.59 nomodify notrap nopeer noquery //当前节点IP地址
restrict 172.18.74.253 mask 255.255.255.0 nomodify notrap //集群所在网段的网关(Gateway),子网掩码(Genmask)测试
2)修改主节点/etc/ntp.confrest
vi /etc/ntp.confserver
在server部分添加一下部分,并注释掉server 0 ~ n同步
server 127.127.1.0
fudge 127.127.1.0 stratum 10it
3)主节点之外,继续修改/etc/ntp.confclass
vi /etc/ntp.conf集群
在server部分添加以下语句,将server指向主节点。
server 172.18.74.39
Fudge 172.18.74.39 stratum 10
3、启动ntp服务、查看状态
1)启动ntp服务
service ntpd start
2)查看ntp服务器有无和上层ntp连通
ntpstat
3)查看ntp服务器与上层ntp的状态
ntpq -p
4、设置开机启动
chkconfig ntpd on
查看从ntp服务状态可能会有以下错误inappropriate address 172.18.74.119 for the fudge command, line ignored经测试改了fudge的首字母为F就能够修复上述错误,看网上也都是小写的,很奇怪。几分钟后查看主从ntp主机的时间就同步了,同步较慢稍等便可。