ntpd服务

yum -y install ntp

服务器端

[root@ip-172-31-6-148~]# vim /etc/ntp.conf 
...
# Use public servers from thepool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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  127.127.1.0     #local clock
fudge   127.127.1.0 stratum 10

客户端节点

vim /etc/ntp.conf 

server 172.31.6.148 iburst

==================

[root@ip-172-31-6-148~]# ntpq -p
     remote           refid      stt when poll reach   delay   offset jitter
==============================================================================
*LOCAL(0)        .LOCL.         10 l   15   64    7    0.000   0.000   0.001
[root@ip-172-31-6-148 ~]# ssh -i fayson.pem.txtip-172-31-5-190.fayson.com "ntpq-p"
     remote           refid      st t when pollreach   delay   offset jitter
==============================================================================
*ip-172-31-6-148 LOCAL(0)        11 u   68  128 377    0.274    1.005   0.243
[root@ip-172-31-6-148 ~]# ssh -i fayson.pem.txtip-172-31-10-118.fayson.com "ntpq-p"               
     remote           refid      stt when poll reach   delay   offset jitter
==============================================================================
*ip-172-31-6-148 LOCAL(0)        11 u  75 128  377    0.285    1.214  0.213
[root@ip-172-31-6-148 ~]# ssh -i fayson.pem.txt ip-172-31-9-33.fayson.com"ntpq -p"                
     remote           refid      stt when poll reach   delay   offset jitter
==============================================================================
*ip-172-31-6-148 LOCAL(0)        11 u    1   64 367    0.294   -9.249   1.511

注:标记部分,有“*”显示则表示同步成功。

原文地址:https://www.cnblogs.com/gaoyuechen/p/11255854.html