首页 > 其他 > 详细

搭建时间同步服务器——简单高效

时间:2015-12-08 07:17:09      阅读:210      评论:0      收藏:0      [点我收藏+]

#安装环境CentOS6.7

一、搭建时间同步服务器(172.16.1.61)

1,查看包是否安装

rpm -qa ntp

若没有找到

yum -y install ntp

2、修改ntp.conf配置文件

#配置前做好备份

cd /etc/

mv ntp.conf ntp.bak.conf

vi /etc/ntp.conf

 14 restrict 127.0.0.1

 15 restrict 0.0.0.0 mask 0.0.0.0 nomodify

 16 restrict -6 ::1

 23 #server 0.centos.pool.ntp.org iburst

 24 #server 1.centos.pool.ntp.org iburst

 25 #server 2.centos.pool.ntp.org iburst

 26 #server 3.centos.pool.ntp.org iburst

 27 server  time.nist.gov

 28 server 210.72.145.44 prefer

 29 server 218.21.130.42

 45 server 127.127.1.0   #local clock

 46 fudge  127.127.1.0   stratum 10

3、添加开机自启动ntp服务

/etc/init.d/ntpd start

chkconfig ntpd on

echo "###start ntp server">>/etc/rc.local

echo "/etc/init.d/ntpd start" >>/etc/rc.local 


二、配置时间同步客户机

1、修改ntp.conf配置文件

#配置前做好备份

cd /etc/

mv ntp.conf ntp.bak.conf

vi /etc/ntp.conf

 22 #server 0.centos.pool.ntp.org iburst

 23 #server 1.centos.pool.ntp.org iburst

 24 #server 2.centos.pool.ntp.org iburst

 25 #server 3.centos.pool.ntp.org iburst

 26 server  172.16.1.61

2、添加定时任务crontab

###create cron by follow ntp server time at 2015-12-07

*/5 * * * * /usr/sbin/ntpdate 172.16.1.61 >/dev/null 2>&1

本文出自 “Linux高级运维之路” 博客,请务必保留此出处http://yulianhui.blog.51cto.com/10829691/1720560

搭建时间同步服务器——简单高效

原文:http://yulianhui.blog.51cto.com/10829691/1720560

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!