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/root

posted @ 2017-06-07 12:53  辛立宝  阅读(296)  评论(0编辑  收藏  举报