Ntpstat and ntpq-p
NTP server [Network Time Protocol (NTP)] is a Protocol used to synchronize the computer Time. It can enable the computer to access its server or clock source (such as quartzels, GPS, and so on) for synchronization, it can provide high-precision time correction (the difference between the LAN and the standard is less than 1 millisecond, And the WAN is dozens of milliseconds ), encryption validation can be used to prevent malicious protocol attacks. The following describes the two commands for viewing the status of ntpserver and their differences.
1. ntpstat
The ntpstat command is used to check the time synchronization status. It usually takes 5 to 10 minutes to connect to and synchronize data. Therefore, wait a moment after the server is started.
When starting, it is generally:
# Ntpstat
Unsynchronised
Time server re-starting
Polling server every 64 s
After connection and synchronization:
Synchronised to NTP server (202.120.2.101) at stratum 4
Time correct to within 1192 MS
Polling server every 64 s
2. ntpq-p
- [root@localhost ~]# ntpq -p
- remote refid st t when poll reach delay offset jitter
- ==============================================================================
- dns1.synet.edu. .INIT. 16 u - 1024 0 0.000 0.000 0.000
- *time.ume.tubita .PPS. 1 u 107 128 377 397.503 -24.042 0.538
- -211.233.84.186 204.123.2.5 2 u 100 128 377 124.228 24.973 0.524
- +dns.sjtu.edu.cn 79.213.241.147 3 u 94 128 377 20.878 3.339 0.512
- +Hshh.org 216.218.192.202 2 u 45 128 377 31.205 10.731 1.278
- dns2.synet.edu. .INIT. 16 u - 1024 0 0.000 0.000 0.000
Note:
* Indicates the ntp server currently in use. The local machine is selected here;
St: stratum class. The smaller the value, the higher the precision of ntp serving;
When: I have performed time synchronization updates several seconds ago;
Poll indicates the number of milliseconds to synchronize with the ntp server;
Reach: the number of times that the NTP server on the upper layer requires updates;
Delay: the time delay during network transmission;
Offset: the result of time compensation;
Jitter: time difference between Linux system time and BIOS hardware time
Note: After the NTP server is restarted, the client will wait for 5 minutes to synchronize time with it. Otherwise, the error "no server suitable for synchronization found" will be displayed. You can run the watch ntpq-p command to monitor the waiting time.