0
点赞
收藏
分享

微信扫一扫

NTP时钟服务器

一、配置安装ntp服务(centos7,8为chrony)
# yum -y install ntp ntpd
# vim /etc/ntp.conf
    driftfile /var/lib/ntp/drift
    logfile /var/log/ntpd.log                     # 日志目录
    restrict default nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict ::1
    restrict 172.16.128.0 mask 255.255.255.0 nomodify notrap        # 授权172.16.128.0网段上的所有机器可以从这台机器上查询和同步时间
    server 0.cn.pool.ntp.org iburst                  # 时间服务器列表
    server 1.cn.pool.ntp.org iburst
    server 2.cn.pool.ntp.org iburst
    server 3.cn.pool.ntp.org iburst
    server 172.16.128.171 iburst                    # 当外部时间不可用时,使用自定义的时间服务器
    fudge 127.0.0.1 stratum 10                      # 时间服务器的层次。设为0则为顶级,如果要向别的NTP服务器更新时间,请不要把它设为0
    restrict 0.cn.pool.ntp.org nomodify notrap noquery              # 允许上层时间服务器主动修改本机时间
    restrict 1.cn.pool.ntp.org nomodify notrap noquery
    restrict 2.cn.pool.ntp.org nomodify notrap noquery
    includefile /etc/ntp/crypto/pw
    keys /etc/ntp/keys
    disable monitor

# systemctl start ntpd
# systemctl enable ntp
# vim /etc/crontab
    14 04 * * * root /usr/sbin/ntpdate ntp.api.bz > /dev/null 2>&1
举报

相关推荐

0 条评论