yum install  ntp  ntpdate  -y

第二步 查找时间同步服务器

http://www.pool.ntp.org/zone/asia

 

 

第三步  编辑 /etc/ntp.conf

添加

restrict default nomodify notrap nopeer noquery
restrict 172.16.100.0 mask 255.255.255.0 nomodify
restrict 10.0.20.0 mask 255.255.255.0 nomodify

第四步  启动ntp服务

systemctl start  ntpd

systemctl enable  ntpd.service   设置开机启动服务

五 验证服务

ntpq -p

watch ntpq -p

2.客户端

第六步  远程客户端时间同步测试

# date 
Fri Jul 15 15:31:22 CST 2016

# ntpdate  10.0.20.245 

第七步 客户端设置计划任务,每天晚上1点同步时间

crontab -e

00 01 * * * root  /usr/sbin/ntpdate  10.0.20.245; /sbin/hwclock -w

参考文章 http://blog.csdn.net/tuolaji8/article/details/51918285