转载来源 :Windows中NTP服务器的搭建和时间同步 :http://www.lwops.cn/thread-308-1-1.html
一、NTP服务器
1.安装NTP服务
# yum install -y ntp
2.修改ntp的配置文件
[root@localhost ~]# grep -Ev "^#|^$" /etc/ntp.conf
driftfile /var/lib/ntp/drift
pidfile /var/run/ntpd.pid
logfile /var/log/ntp.log
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
restrict 127.0.0.1
restrict ::1
server ntp.aliyun.com iburst minpoll 4 maxpoll 10
restrict ntp.aliyun.com nomodify notrap nopeer noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 8
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
3.重启服务
# systemctl start ntpd.service
# systemctl enable ntpd.service
4.查看状态
[root@localhost ~]# ntpstat
synchronised to NTP server (203.107.6.88) at stratum 3
time correct to within 46 ms
polling server every 1024 s
[root@localhost ~]#
二、Linux客户端配置
1.安装ntp客户端,先手动同步
# /usr/sbin/ntpdate -u 10.2.2.188
# yum install -y ntpdate
2.写入定时计划
# echo "0 5 * * * /usr/sbin/ntpdate -u 10.2.2.188" >> /var/spool/cron/root
# echo "5 5 * * * /usr/sbin/hwclock -w" >> /var/spool/cron/root
三、window2012客户端配置(若有域环境直接修改与控制器即可)
1.打开powershell终端管理,输入gpedit.msc,打开策略管理器
2.计算机配置–>管理模板–>系统–>Windows时间服务–>时间提供程序,配置(windows客户端和启动客户端)
3.跟新策略
参考链接 :Windows中NTP服务器的搭建和时间同步 :http://www.lwops.cn/thread-308-1-1.html