[root@bigdata001 ~]# vim /etc/ntp.conf
#time
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
#当外部时间不可⽤时,可使⽤本地硬件时间
server 127.127.1.0 iburst local clock
#允许哪些⽹段的机器来同步时间
restrict 172.22.95.0 mask 255.255.255.0 nomodify notrap
第一台机器启动 ntp 服务
[root@bigdata001 ~]# systemctl start ntpd
[root@bigdata001 ~]# systemctl status ntpd
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-02-10 12:15:22 CST; 6min ago
Main PID: 9479 (ntpd)
CGroup: /system.slice/ntpd.service
└─9479 /usr/sbin/ntpd -u ntp:ntp -g
Feb 10 12:15:22 bigdata001 systemd[1]: Starting Network Time Service...
Feb 10 12:15:22 bigdata001 ntpd[9479]: proto: precision = 0.080 usec
Feb 10 12:15:22 bigdata001 ntpd[9479]: 0.0.0.0 c01d 0d kern kernel time sync enabled
Feb 10 12:15:22 bigdata001 systemd[1]: Started Network Time Service.
[root@bigdata001 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
LOCAL(0) .LOCL. 10 l 411 64 100 0.000 0.000 0.000
+120.25.115.20 10.137.53.7 2 u 12 64 177 24.430 1081.30 8.310
10.143.33.49 .INIT. 16 u - 1024 0 0.000 0.000 0.000
+100.100.3.1 10.137.55.181 2 u 43 64 377 1.482 1081.81 6.647
+100.100.3.2 10.137.55.181 2 u 43 64 377 1.332 1081.10 7.352
+100.100.3.3 10.137.55.181 2 u 38 64 377 1.470 1080.94 7.428
+203.107.6.88 10.137.38.86 2 u 38 64 377 16.084 1081.27 6.672
10.143.33.50 .INIT. 16 u - 1024 0 0.000 0.000 0.000
10.143.33.51 .INIT. 16 u - 1024 0 0.000 0.000 0.000
10.143.0.44 .INIT. 16 u - 1024 0 0.000 0.000 0.000
10.143.0.45 .INIT. 16 u - 1024 0 0.000 0.000 0.000
10.143.0.46 .INIT. 16 u - 1024 0 0.000 0.000 0.000
+100.100.5.1 10.137.55.181 2 u 29 64 377 1.545 1081.31 7.467
+100.100.5.2 10.137.55.181 2 u 35 64 377 1.819 1082.29 6.611
*100.10