View NTP servers being used using the NTPQ command in Linux

Home > Search > Linux commands
  by

The ntpq command without any options will start an interactive prompt.

[root@server1 ~]# ntpq
ntpq>

 

The interactive prompt accepts a variety of input, such as hostnames, ntpversion, and passwd. In this example, the help option is used to find information on what peers are.

[root@server1 ~]# ntpq
ntpq> help peer
function: obtain and print a list of the server's peers [IP version]
usage: peers [ -4|-6 ]
ntpq>

 

As another innocent example, the version option can be used to view the version of NTP being used.

[root@server1 ~]# ntpq
ntpq> version
ntpq 4.2.6p5@1.2349-o Wed Apr 12 21:24:08 UTC 2017 (1)
ntpq>

 


Display the remote NTP servers being used

The -p option can be used to print the remote NTP servers currently being used for synchronization. In this example, there are four remote NTP servers being used for synchronization. The record that begins with the * special character is the primary NTP server, and the record that begin with + is the secondary NTP servers.

[root@server1 ~]# ntpq -p
     remote             refid      st t when poll reach   delay   offset  jitter
================================================================================
 utcnist2.colora   .NIST.           1 u   17   64    1   46.530    0.490   7.191
+ntp2.wiktel.com   212.215.1.157    2 u   15   64    1   38.248    0.115   0.104
 triton.ellipse.   216.229.0.179    2 u   24   64    0    0.000    0.000   0.000
*ntp.wdc1.us.lea    130.133.1.10    2 u   15   64    1   50.979   -1.408   0.087

 


Display IP addresses instead of hostnames

The -n option can be used to display IP addresses instead of hostnames. In this example, both the -n and -p options are used.

[root@server1 ~]# ntpq -np
     remote             refid      st t when poll reach   delay   offset  jitter
================================================================================
 128.138.141.172   .NIST.           1 u   17   64    1   46.530    0.490   7.191
+69.89.207.199     212.215.1.157    2 u   15   64    1   38.248    0.115   0.104
 216.229.4.69      216.229.0.179    2 u   24   64    0    0.000    0.000   0.000
*108.59.2.24        130.133.1.10    2 u   15   64    1   50.979   -1.408   0.087

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments