您的位置:首页 > 其它

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

2015-12-07 22:30 302 查看
#安装环境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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: