Ntpq -p status change

Hi, my name is Nori, from Japan. I’m creating an ntp server on RasPi 4B. My RasPi is connected to GNSS sensor, Spatial Dual by ADVANCED NAVIGATION. So my ntp server corrects its time by receiving GPS and PPS signal.

When I check the server behavior by sending ntpq -p command, it shows following status.

remote           refid      st t when poll reach   delay   offset  jitter
==================================================================
*SHM(0)          .GPS.           14 l    1   16  377    0.000    7.196   1.457
oPPS(0)          .PPS.            0 l   19   64  377    0.000   -2.369  10.883
+ntp-a3.nict.go. .NICT.           1 u   15   64  177   13.840   41.227  21.948

After a while it shows like this.

remote           refid      st t when poll reach   delay   offset  jitter
==================================================================
xSHM(0)          .GPS.           14 l    8   16  377    0.000    9.534   0.708
xPPS(0)          .PPS.            0 l   26   64  377    0.000    0.085   5.913
xntp-a3.nict.go. .NICT.           1 u   11   64  377   13.936   58.650  12.450

My question is :

(1)How does the status, “" and “o” and “+” and “x” and space, changes?
Or what condition or signal changes does ntp server use to change the status.
(2)Is the status change affected by WiFi connection?
Once WiFi is established GPS shows "
”, PPS shows “o”. And if disconnected
GPS shows “*”, PPS shows “o”. Why?
(3)Even if WiFi is established, GPS and PPS shows “x” after 5 or 10 minutes. Why?
(4)I send ntpq -p command without transfering root right. Does the root right affect
the behavior (3)?

If possible please advise me any good documents I have to read.
Sorry it might be very basic knowledge, but I’m new on ntp server.

Thank you,

Hi and welcome, this is a useful site: https://www.eecis.udel.edu/~mills/ntp/html/#build

Please can you post your ntp.conf

P.S. It’s easier to follow if you reply to the same thread rather than start a new thread each time you post :slight_smile:

Hi, elljay.

Here is my ntp.conf.

driftfile /var/lib/ntp/ntp.drift

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1   mask 255.255.255.0
restrict 192.168.1.0 mask 255.255.255.0
restrict -6 ::1

# SHM(0) GPS
server 127.127.28.0 prefer minpoll 4 maxpoll 4
fudge  127.127.28.0 time1 0.002 refid GPS stratum 14

# SHM(1) PPS
server 127.127.22.0 
fudge  127.127.22.0 time1 -0.060 refid PPS stratum 0

# NTP synchronization preferexit
server ntp.nict.jp iburst prefer

Hi Nori,
you have set the option prefer two times.
If you just want to monitor your NTP time with ntp.nict.jp remove the prefer and insert a noselct.

from:
server ntp.nict.jp iburst prefer
to:
server ntp.nict.jp iburst noselect

You will stil see the ntp.nict.jp entry but your NTP won’t select it as a source.

Hi aplus,

Thank you for your reply.
I’ll try.

By the way, do you have any good documents or resources I can learn how to
define ntp.conf file by myself?

Thank you,

Although not in an ordinary manpage style, the official documentation of ntpd and how to write its config can always be found on the protocol founder’s page:
https://www.eecis.udel.edu/~mills/ntp/html/comdex.html
And below is my current ntp.conf, shared here for reference:

# Sample /etc/ntp.conf:  Configuration file for ntpd.
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
#server 127.127.1.0     # local clock
#fudge  127.127.1.0 stratum 10
server  127.127.28.0    noselect        # Garmin GPS18x LVC NMEA
fudge   127.127.28.0    time1   0.305   refid   GPS
server  127.127.28.1    prefer          # Garmin GPS18x LVC PPS
fudge   127.127.28.1    refid   PPS
server  tick.stdtime.gov.tw     iburst  minpoll 9       maxpoll 17
server  tock.stdtime.gov.tw     iburst  minpoll 9       maxpoll 17
server  time.stdtime.gov.tw     iburst  minpoll 9       maxpoll 17
server  clock.stdtime.gov.tw    iburst  minpoll 9       maxpoll 17
server  watch.stdtime.gov.tw    iburst  minpoll 9       maxpoll 17
#server stdtime.gov.hk                  # http://www.hko.gov.hk/nts/ntimec.htm
#pool   ntp.nict.go.jp.                 # http://jjy.jp/tsp/PubNtp/
#pool   ntp-a.nict.go.jp
#pool   ntp-b.nict.go.jp
server  ntp-a2.nict.go.jp       iburst  minpoll 9       maxpoll 17
server  ntp-a3.nict.go.jp       iburst  minpoll 9       maxpoll 17
server  ntp-b2.nict.go.jp       iburst  minpoll 9       maxpoll 17
server  ntp-b3.nict.go.jp       iburst  minpoll 9       maxpoll 17
# jp time polling interval restrictions -> http://jjy.jp/tsp/PubNtp/qa.html#q1-4
#server nets.org.sg                     # http://support.ntp.org/bin/view/Servers/PublicTimeServer000254
# other nearby nations
#server time.kriss.re.kr                # http://www.kriss.re.kr/standard/view.do?pg=standard_set_02
#server mst.sirim.my                    # http://mst.sirim.my/
#server ntp.pagasa.dost.gov.ph          # https://www1.pagasa.dost.gov.ph/index.php/astronomy/philippine-standard-time

#
# NTP server (list one or more) to synchronize with:
#server 0.pool.ntp.org iburst
#server 1.pool.ntp.org iburst
#server 2.pool.ntp.org iburst
#server 3.pool.ntp.org iburst

#
# Drift file.  Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /etc/ntp/drift

#
# Uncomment to use a multicast NTP server on the local subnet:
#multicastclient 224.0.1.1              # listen on default 224.0.1.1
# Set an optional compensation for broadcast packet delay:
#broadcastdelay 0.008

#
# Keys file.  If you want to diddle your server at run time, make a
# keys file (mode 600 for sure) and define the key number to be
# used for making requests.
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will.
#
#keys           /etc/ntp/keys
#trustedkey     65535
#requestkey     65535
#controlkey     65535

#
# Don't serve time or stats to anyone else by default (more secure)
# (These in fact serves time but no stats)
# below is generic default rule: only serves time
#restrict default limited kod nomodify notrap nopeer noquery
# 190510: general low priority, block old version packets
restrict -4 default ntpport version lowpriotrap notrap nopeer noquery
restrict -4 default version lowpriotrap notrap nopeer noquery
# 190510: ntppool ewr monitor location, normal priority
restrict 139.178.64.0 mask 255.255.224.0 notrap nopeer noquery
# my original ipv4 rule
#restrict default limited kod notrap nopeer noquery
#restrict -6 default limited kod nomodify notrap nopeer noquery
# (I'm not seving ipv6)
restrict -6 default ignore

#
# Use these lines instead if you do want to serve time and stats to
# other machines on the network:
#restrict default limited kod nomodify notrap nopeer
#restrict -6 default limited kod nomodify notrap nopeer

#
# Disable the ntpdc -c monlist command, which is insecure and can be used
# to cause a denial of service attack (CVE-2013-5211). Future versions of
# NTP will remove this command.
# (this feature was disabled by default with ntpd 4.2.7p230)
disable monitor

#
# Trust ourselves.  :-)
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.255.0
#restrict ::1

# Memory for mrulist (to rate limiting)
mru maxmem 2048 mindepth 6000

# Leap seconds list (update checks from cron.monthly)
leapfile        /etc/ntp/leap-seconds.list

Hi Nori,

as alica wrote, you can take a look at the manpage or the webite.
But you can also take a look here: NTP Basics or here ntp.conf description