Create Local NTP

Controller node

Install Chrony

  1. [root@localhost ~]# yum install chrony -y

Edit the /etc/chrony.conf file

  1. [root@localntp ~]# diff /etc/chrony.conf /etc/chrony.conf_bak
  2. 3,7c3,6
  3. < #server 0.centos.pool.ntp.org iburst
  4. < #server 1.centos.pool.ntp.org iburst
  5. < #server 2.centos.pool.ntp.org iburst
  6. < #server 3.centos.pool.ntp.org iburst
  7. < server 192.168.220.201 iburst
  8. ---
  9. > server 0.centos.pool.ntp.org iburst
  10. > server 1.centos.pool.ntp.org iburst
  11. > server 2.centos.pool.ntp.org iburst
  12. > server 3.centos.pool.ntp.org iburst
  13. 28d26
  14. < allow 192.168.220.0/24

Start the NTP service

  1. [root@localhost ~]# systemctl enable chronyd.service
  2. [root@localhost ~]# systemctl start chronyd.service
  3. [root@localhost ~]# systemctl restart chronyd.service

Other nodes

Install Chrony

  1. [root@localhost ~]# yum install chrony -y

Edit the /etc/chrony.conf file

  1. [root@localhost ~]# diff /etc/chrony.conf /etc/chrony.conf_bak
  2. 3,7c3,6
  3. < #server 0.centos.pool.ntp.org iburst
  4. < #server 1.centos.pool.ntp.org iburst
  5. < #server 2.centos.pool.ntp.org iburst
  6. < #server 3.centos.pool.ntp.org iburst
  7. < server 192.168.220.201 iburst
  8. ---
  9. > server 0.centos.pool.ntp.org iburst
  10. > server 1.centos.pool.ntp.org iburst
  11. > server 2.centos.pool.ntp.org iburst
  12. > server 3.centos.pool.ntp.org iburst

Start the NTP service

  1. [root@localhost ~]# systemctl enable chronyd.service
  2. [root@localhost ~]# systemctl start chronyd.service
  3. [root@localhost ~]# systemctl restart chronyd.service

Verify operation

controller node

  1. [root@localhost ~]# chronyc sources
  2. 210 Number of sources = 1
  3. MS Name/IP address         Stratum Poll Reach LastRx Last sample               
  4. ===============================================================================
  5. ^? localhost.localdomain         0   8     0     -     +0ns[   +0ns] +/-    0ns

other nodes

  1. [root@localhost ~]# chronyc sources
  2. 210 Number of sources = 1
  3. MS Name/IP address         Stratum Poll Reach LastRx Last sample               
  4. ===============================================================================
  5. ^? 192.168.220.201               0   8     0     -     +0ns[   +0ns] +/-    0ns

Leave a Reply

Your email address will not be published. Required fields are marked *