What is the refid in ntpq -p output?

Question

When executing an ntpq -p command, what is the refid?

$ ntpq -p
remote                refid            st t  when poll  reach   delay   offset   jitter
========================================================================================
*myntp.example.com   192.168.102.252   2  u  161  1024  377     0.841   -0.442   1.365

Answer

A stratum-0 is an actual time source. It is connected to a server which is a stratum-1 server. Systems that use a stratum-1 system as their time source are stratum-2. Systems that use stratum-2 servers as their time source are stratum-3, so on and so forth. The further from the source, the less accurate the devices become.

The refid is the ultimate time source used. For example:

$ ntpq -p
remote                refid       st t when poll reach   delay   offset   jitter
==============================================================================
*myntp.example.com 192.168.201.11 2 u  161 1024  377    0.841   -0.442   1.365

The system is using myntp.example.com as it’s time source. The server myntp.example.com is ultimately getting its time from 192.168.201.11.

The purpose is so that servers do not use each other as their time source. If nodeA has nodeB as it’s refid, then nodeB would not be able to use nodeA as its source.

Other fields in ntpq -p command output

To better understand the output of the ntpq -p command, I’ll go through each column. First, the remote column details the NTP servers we’re connected to. The refid column refers to the NTP servers that the remote servers are connected to. The st column refers to a server’s stratum, which refers to how close the server is from us (the lower the number, the closer, and typically, better). The t column refers to the type, specifically whether the server is using unicast, broadcast, multicast, or manycast.

Continuing, the when column refers to how long ago it was since the last time the server was polled. The poll column indicates how often the server will be polled, which is 64 seconds for most of the entries in the example screenshot. The reach column contains the results of the most recent eight NTP updates. If all eight are successful, this field will read 377. This number is in octal, so eight successes in octal will be represented by 377. When you first start the ntp daemon on your server, it may take some time for this number to reach 377.

Finally, we have the delay, offset, and jitter columns. The offset column refers to the delay in reaching the server, in milliseconds. Offset references the difference between the local clock and the server’s clock. Finally, the jitter column refers to the network latency between your server and theirs.

Related Post