ntpq - BYO-NTP/recipes GitHub Wiki
There's a legend below, to help interpret the output.
This is a host running NTPsec with a $12 VK-162 USB GPS
ntpq -c peers
😈 ➜ ntpq -c peers
remote refid st t when poll reach delay offset jitter
==============================================================================
+dns1.home.simer 140.5.188.42 2 u 38 64 377 0.164 +0.204 0.306
+dns2.home.simer 140.5.188.42 2 u 33 64 377 0.161 -0.337 0.374
+time.cloudflare 10.30.9.156 3 u 62 64 377 3.464 +1.130 0.437
*NMEA(0) .NMEA. 0 l 14 16 377 0.000 +4.790 4.077
The *
is indicating that the USB attached GPS unit is the system peer. Note that the delay is very low but the jitter is rather high. Despite the high variability of this source, this peer survives due to the mindist setting.
This is a Pi 4 running NTPsec with a GPS hat:
🌀 ➜ ntpq -c pe
remote refid st t when poll reach delay offset jitter
=======================================================================================================
*dns1.home.simerson.net 140.5.188.42 2 u 42 64 377 0.2123 0.5374 0.0171
+dns2.home.simerson.net 140.5.188.42 2 u 36 64 377 0.2423 0.5240 0.0369
+time.cloudflare.com 10.31.8.5 3 u 13 64 277 3.6371 1.5321 0.2368
+NMEA(0) .NMEA. 0 l 5 8 377 0.0000 -1.3618 0.8813
oPPS(0) .PPS. 0 l - 4 377 0.0000 -0.0001 0.0017
In this case, dns1, a remote server on the LAN (note the small delay) is the system peer and the PPS source is active and disciplining the system clock. All three of the other sources are +
candidates to be the system peer. This is ideal as it'll keep us from losing our PPS sync. See also, mindist.
After starting ntpd, it can take 15 minutes to "settle in." That can be reduced to nearer 30 seconds when at least 2 good NTP servers have iburst enabled. After ntpd has selected a ticker, it will start listening to the GPS unit and attempt to sync the PPS signal with the NMEA stream. If it succeeds, the refclock gets the o
prefix in the ntpq -p
output.
😈 ➜ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
oGPS_NMEA(0) .NMEA. 0 l - 64 377 0.000 +100.00 0.196
+ntp1.----.----- ------------ 2 u 26 64 377 0.167 +100.68 0.207
+ntp2.----.----- ------------ 2 u 31 64 377 0.154 +100.19 0.228
Additional PPS data can be found in other ntpq sections:
😈 ➜ ntpq -c kerninfo | grep pps
kernel status: pll ppsfreq ppstime ppssignal nano
pps frequency: 37.9837
pps stability: 0.217575
pps jitter: 0.013
😈 ➜ ntpq -c cv
associd=0 status=0010 1 event, clk_unspec,
device="NMEA GPS Clock", timecode="$GNZDA,035606.00,14,05,2025,00,00*7B",
poll=42, noreply=1, badformat=0, baddata=0, fudgetime1=100.000,
stratum=0, refid=NMEA, flags=5
If your clock is seen but ntpd is not discliplining your machines clock, check the associations:
😈 ➜ ntpq -c as
ind assid status conf reach auth condition last_event cnt
===========================================================
1 15312 971b yes yes none pps.peer clock_alarm 1
2 15313 941a yes yes none candidate sys_peer 1
3 15314 9414 yes yes none candidate reachable 1
Ahah, a clock_alarm. I don't know what that means but restarting ntpd resolved it.
😈 ➜ ntpq -c as
ind assid status conf reach auth condition last_event cnt
===========================================================
1 44806 971a yes yes none pps.peer sys_peer 1
2 44807 9414 yes yes none candidate reachable 1
3 44808 9614 yes yes none sys.peer reachable 1
ntpq -c lopeers (gets disp..ersion?)
associd=0 status=0015 leap_none, sync_unspec, 1 event, clock_sync, leap=00, stratum=4, precision=-22, rootdelay=22.078, rootdisp=12.24, refid=10.0.1.4, reftime=ebb797c6.30fd52ad 2025-04-26T17:35:02.191Z, tc=7, peer=17768, offset=0.169353, frequency=-9.887756, sys_jitter=0.267779, clk_jitter=1.174071, clock=ebb79a0b.e6bf007b 2025-04-26T17:44:43.901Z, processor="aarch64", system="Linux/6.12.20+rpt-rpi-v8", version="ntpd ntpsec-1.2.2", clk_wander=0.095489, tai=37, leapsec="2017-01-01T00:00Z", expire="2025-12-28T00:00Z", mintc=0
On macOS, run this command (with a valid hostname) in a new Terminal.app window:
printf '\e[8;9;80t'; ssh -t pi5.local watch -n3 ntpq -c peer
If the remote is FreeBSD, install the gnu-watch package and use by that name (there's already a different 'watch' utility on FreeBSD).
for ntpq -c peers
|
|