Synchronization time of ntp server deployment in Centos7
View the time zone list: timedatectl list-timezones | grep Asia
Set China Time Zone: timedatectl set-timezone Asia/Shanghai. After the execution, the time is changed to Beijing time.
View Current Time: date
View Current Settings:
[Root @ localhost ~] # Timedatectl
Local time: Mon 2017-10-09 16:44:08 CST
Universal time: Mon 2017-10-09 08:44:08 UTC
RTC time: Mon 2017-10-09 08:44:08
Time zone: Asia/Shanghai (CST, + 0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/
If no system has an ntp server installed, you can install yum install ntp-y.
Edit the ntp configuration file vi/etc/ntp. conf (the log file is in/var/log/messages by default) and add the following server domain names. If the original configuration file does not exist
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
Systemctl restart ntpd
Systemctl enable ntpd
In this way, the server is configured almost, but to make the effect more obvious, I changed the server to the New York time zone, and the time zone of another linux client to be synchronized to the Africa time, as a result, ntpdate on the client is not synchronized after ntpdate, and later we found that the time must be synchronized within the same time zone. That is to say, the time zone on the server and client must be in the China time zone.
Check whether the ntp server configuration is successful.
On the server (ip: 10.0.3.66)
Use date-s 23:30:30 (the time can be changed at will, but it can be changed to a time different from the client's time), and then the date can be seen as 23:30:30.
On the client
After ntpdate 10.0.3.66 is executed, it turns to 23:30:30.