学习地址:
Protocol
The Network Time Protocol (NTP) is a protocol used to synchronize computer system clock automatically over a networks. The machine can have the system clock use Coordinated Universal Time (UTC) rather than local time.
ntpdate
The most common method to sync system time over a network in Linux desktops or servers is by executing the ntpdate
command which can set your system time from an NTP time server. In this case, the ntpd daemon must be stopped on the machine where the ntpdate
command is issued.
Installation:
|
|
Example:
|
|
In order to just query the server and not set the clock and use an unprivileged port to send the packets from, in order to bypass firewalls, issue ntpdate
with the below flags:
|
|
Always try to query and sync the time with the closest NTP servers available for your zone. The list of the NTP server pools can be found at the following address: https://www.pool.ntp.org/en/
此后可以通过 date
指令查看系统时间。