美文网首页
CentOS7 minimal ntp chrony

CentOS7 minimal ntp chrony

作者: 余带盐 | 来源:发表于2018-05-28 12:09 被阅读0次
    • ntp服务器(192.168.0.242 node2)(暂时没测试出来,不使用)
    1. 下载
      yum install ntp -y
    2. 配置
      vi /etc/ntp.conf
    ...
    #restrict default nomodify notrap nopeer noquery
    restrict default nomodify  #允许其他任意ip主机同步
    ...
    server 127.0.0.1     # 使用本地时间
    fudge  127.0.0.1 stratum 10
    ...
    #server 0.centos.pool.ntp.org iburst
    #server 1.centos.pool.ntp.org iburst
    #server 2.centos.pool.ntp.org iburst
    #server 3.centos.pool.ntp.org iburst
    ...
    
    image.png
    1. 启动服务
      systemctl start ntpd
      systemctl enable ntpd
    2. 查看
      ntpq -p
      image.png
    • ntp客户端(192.168.0.242 nod3)(暂时没测试出来,不使用)
    1. 下载
      yum install ntp -y
    2. 配置
      vi /etc/ntp.conf
    ...
    #server 0.centos.pool.ntp.org iburst
    #server 1.centos.pool.ntp.org iburst
    #server 2.centos.pool.ntp.org iburst
    #server 3.centos.pool.ntp.org iburst
    server node2 iburst
    ...
    
    image.png
    1. 启动服务
      systemctl start ntpd
      systemctl enable ntpd
    2. 查看
      ntpq -p
      image.png
    3. 验证

    引用:centos7局域网同步时间ntp


    • chrony服务器
    1. 下载:yum install chrony
    2. 配置:vi /etc/chrony.conf
    #server 0.centos.pool.ntp.org iburst
    #server 1.centos.pool.ntp.org iburst
    #server 2.centos.pool.ntp.org iburst
    #server 3.centos.pool.ntp.org iburst
    server ntp1.aliyun.com iburst #如果是局域网的话就不需要这个
    allow 192.168.0.0/24
    local stratum 10
    bindcmdaddress 127.0.0.1
    bindcmdaddress ::1
    
    image.png
    1. 启动
      systemctl enable chronyd
      systemctl start chronyd
    2. 验证
      chronyc sources -v
      image.png
    • chrony客户端
    1. 下载:yum install chrony
    2. 配置:vi /etc/chrony.conf
    #server 0.centos.pool.ntp.org iburst
    #server 1.centos.pool.ntp.org iburst
    #server 2.centos.pool.ntp.org iburst
    #server 3.centos.pool.ntp.org iburst
    server node2 iburst
    
    
    image.png
    1. 启动
      systemctl enable chronyd
      systemctl start chronyd
    2. 验证
      chronyc sources -v
      注:MS字段中S*才算连接上
      image.png
    3. 测试
      修改客户端的时间:date -s 14:00:00
      然后重启chronyd:systemctl restart chronyd
      就可以重新对时
      通过systemctl status chronyd,可以查看日志
      image.png

    相关文章

      网友评论

          本文标题:CentOS7 minimal ntp chrony

          本文链接:https://www.haomeiwen.com/subject/oorsjftx.html