m61管理機 服務端配置vim
查看是否安裝看ntpcentos
rpm -qa ntp服務器
若沒有 yum -y install ntpsocket
配置ntp服務ide
vim /etc/ntp.conf測試
8 #restrict default kod nomodify notrap nopeer noquery #<==第八行註釋掉,在第八行下加上一行。ui
9 restrict default nomodify #<==容許全部IP段spa
19 #restrict 192.168.1.0 mask 255.255.255.0 nomodify notraprest
20 restrict 172.16.1.0 mask 255.255.255.0 nomodify notrap #<==容許指定的IP段server
#容許全部的和容許指定的選擇其一就可。
24 #server 0.centos.pool.ntp.org iburst #<==將默認時間同步源註釋掉,改用可用源
25 #server 1.centos.pool.ntp.org iburst
26 #server 2.centos.pool.ntp.org iburst
27 #server 3.centos.pool.ntp.org iburst
28 server ntp1.aliyun.com
29 server time.nist.gov
啓動ntp服務器
若是計劃任務有時間同步,先註釋,兩種用法會衝突
[root@ntp ~]# crontab -e
#time sync by lidao at 2016-09-08
#*/5 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1
[root@ntp ~]# /etc/init.d/ntpd start
[root@m01-61 ~]# ntpdate 10.0.0.61
15 Feb 09:31:03 ntpdate[15370]: the NTP socket is in use, exiting
crontab -e
#time sync by lidao at 2016-09-08
#*/5 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1
*/5 * * * * /usr/sbin/ntpdate 10.0.0.12 >/dev/null 2>&1
############# ntp客戶端的時間同步###########
客戶機要等幾分鐘再與新啓動的ntp服務器進行時間同步,不然會提示no server suitable for synchronization found錯誤。
crontab -e
#time sync by Mr.sun at 2016-09-08
#*/5 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1
*/5 * * * * /usr/sbin/ntpdate 10.0.0.12 >/dev/null 2>&1
測試是否成功
ntpdate 10.0.0.61