NTP時間服務器安裝

  #NTP服務器安裝
rpm -qa ntp
#yum -y install ntp
#配置NTP服務
vim /etc/ntp.conf
#restrict default kod nomodify notrap nopeer noquery
restrict default nomodify
# nomodify客戶端能夠同步
# 將默認時間同步源註釋改用可用源
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server ntp1.aliyun.com
server time.nist.gov
#啓動NTP服務器
# 若是計劃任務有時間同步,先註釋,兩種用法會衝突。
/etc/init.d/ntpd start
ntpq -p
chkconfig ntpd on
chkconfig --list ntpd
ntpstat
ntpdate 10.0.0.61
#客戶機時間同步
#客戶機要等幾分鐘再與新啓動的ntp服務器進行時間同步,不然會提示no server suitable for synchronization found錯誤。
ntpdate 10.0.0.61
# 將命令放入計劃任務便可。
#服務器端,客戶端定時任務配置
echo "*/1 * * * * /usr/sbin/ntpdate 10.0.0.61 >/dev/null 2>&1" >>/var/spool/cron/root
##sed -i 's#time.nist.gov#10.0.0.61#g' /var/spool/cron/rootvim

相關文章
相關標籤/搜索