一、測試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