Introdução ao NTP
NTP é um protocolo de sincronização de tempo de rede, que é um protocolo usado para sincronizar a hora de cada computador na rede.
Prepare dois testes de ambiente centos7
Um servidor (136) Um cliente (137)
1. Desligue o firewall setenforce
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
2. Instale e configure o serviço ntp no lado do servidor
[root@localhost ~]# yum -y install ntp
[root@localhost ~]# vim /etc/ntp.conf
3. Comece a visualizar o ntp
[root@localhost ~]# systemctl start ntpd
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 5 l 4 64 1 0.000 0.000 0.000
114.118.7.161 123.139.33.3 2 u 3 64 1 80.643 271.746 0.000
203.107.6.88 100.107.25.114 2 u 2 64 1 17.522 311.783 0.000
4. Instale ntpdate no cliente
[root@localhost ~]# yum -y install ntpdate
teste
1. Simule e modifique a hora no lado do servidor
[root@localhost ~]# date -s "2018-08-8 04:53"
2018年 08月 08日 星期三 04:53:00 CST
2. Verifique a hora sincronizando a hora do servidor no cliente
[root@localhost ~]# ntpdate -u 192.168.27.136
8 Aug 04:56:25 ntpdate[13694]: step time server 192.168.27.136 offset 38531233.207033 sec
[root@localhost ~]# date
2018年 08月 08日 星期三 04:56:03 CST
Pode haver um atraso de cerca de 30 segundos durante o teste