配置一台时间服务器

1、配置一台时间服务器,让其它主机和时间服务器同步,并实现自动化任务每5分钟同步一次。

  #Server:开启ntp

      vi /etc/ntp.conf

        driftfile /var/lib/ntp/drift

restrict default nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict ::1

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

server s1a.time.edu.cn

server s1b.time.edu.cn

server 202.120.2.101

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

disable monitor

 systemctl restart ntpd

#client

  vi /etc/ntp.conf

    driftfile /var/lib/ntp/drift

restrict default nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict ::1

server 192.168.1.142

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

disable monitor

crontab –e

*/5 * * * * /usr/sbin/ntpdate 192.168.1.142

原文地址:https://www.cnblogs.com/han1094/p/6351813.html