1.搭建环境 环境:CentOS6.5 Server 192.168.3.130 Client 192.168.3.131 2.NTP服务器配置 安装NTP # yum -y install ntp ntpdate 修改配置文件 # vi /etc/ntp.conf server 210.72.145.44 prefer #服务器同上层服务器时间同步的IP地址,prefer代表首选IP地址 server 0.asia.pool.ntp.org server 1.asia.pool.ntp.org server 2.asia.pool.ntp.org driftfile /etc/ntp/drift #记录上次的NTP server与上层NTP server联接所花费的时间 restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允许任何主机跟进行时间同步 logfile /var/log/ntpstats/ntp.log #设置ntp日志文件 启动NTP服务和设置开机启动 # service ntpd start # chkconfig ntpd on 关闭并禁用防火墙 # service iptables stop # chkconfig iptables off 3.客户端配置 手动执行同步 # ntpdate 192.168.3.130 设置计划任务每10分钟时间同步一次并写入本机BIOS # crontab –e */10 * * * * /usr/sbin/ntpdate 192.168.3.130;/sbin/hwclock -w >> /root/ntpdate.log 2>&1