Introduction to NTP
NTP is a network time synchronization protocol, which is a protocol used to synchronize the time of each computer in the network.
Prepare two centos7 environment tests
One server (136) One client (137)
1. Turn off the firewall setenforce
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
2. Install and configure the ntp service on the server side
[root@localhost ~]# yum -y install ntp
[root@localhost ~]# vim /etc/ntp.conf
3. Start to view 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. Install ntpdate on the client
[root@localhost ~]# yum -y install ntpdate
test
1. Simulate and modify the time on the server side
[root@localhost ~]# date -s "2018-08-8 04:53"
2018年 08月 08日 星期三 04:53:00 CST
2. Check the time by synchronizing the server time on the client
[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
There may be a delay of about 30 seconds during the test