您的位置:首页 > 运维架构 > Linux

设置CentOS6.5时钟同步

2016-11-30 17:33 211 查看

一、测试ntp服务

# rpm -q ntp
ntp-4.2.4p8-2.el6.x86_64    // 这表示已安装了,如果没有安装,这是空白。


二、/etc/ntp.conf

  红色部分是修改的。





  配置文件修改完成,保存退出,启动服务。

service ntpd start


  ntpstat 命令查看时间同步状态,这个一般需要5-10分钟后才能成功连接和同步。所以,服务器启动后需要稍等下。

三、配置其他节点

  其他的没列举

driftfile /var/lib/ntp/drift
restrict 127.0.0.1
restrict -6 ::1

# 配置时间服务器为本地的时间服务器
server 192.168.1.135

restrict 192.168.1.135 nomodify notrap noquery

server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys 


  OK,保存退出,请求服务器前,请先使用ntpdate手动同步下时间

# ntpdate -u 192.168.0.135

22 Dec 17:09:57 ntpdate[6439]: adjust time server 192.168.1.135 offset 0.004882 sec


  然后启动服务

service ntpd start


四、配置开机启动

chkconfig --level 35 ntpd on


 

参考文献 http://acooly.iteye.com/blog/1993484
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: