Skip to main content

Local GPS NTP Time Server

Accessible at: 192.168.1.12
Project files stored here: “\\192.168.1.11\zfs_mirror3\Projects\Dormant\NTP Raspberry Pi Server”

Build Data

Runs Raspian on a Raspberry PI

Static IP Address was set in: /etc/dhcpcd.conf

image.png

Installed ntpstat with this:

sudo apt install ntpstat

Usage

Here's some descriptions of the different tools for administrating NTP.

NTPSTAT

Use ntpstat to check if the NTP service is in sync:

ntpstat

It will return something like this:

synchronised to NTP server (149.20.54.20) at stratum 3 
   time correct to within 42 ms
   polling server every 1024 s

For our local NTP server (with GPS receiver), we see this:

pi@raspberrypi:~ $ ntpstat
synchronised to UHF radio at stratum 1
   time correct to within 2 ms
   polling server every 64 s

The ntpstat utility also returns an exit status, as a quick tell of synchronization.

Use this, following a call to ntpstat:

echo $?

The return value will mean one of these:

  • If exit status 0 – Clock is synchronised.
  • exit status 1 – Clock is not synchronised.
  • exit status 2 – If clock state is indeterminant, for example if ntpd is not contactable.

NTPQ

Use ntpq -p to see the following:

image.png

PPTSTEST

Use this to test the pps signal:
sudo ppstest /dev/pps0

The output should spit out a new line every second that looks something like this (your output will be a bit farther from x.000000 since it isn’t yet using the GPS PPS):

image.png

GPSMON

Use the gps monitor function to check the realtime availability of GPS and satelite count and position, with this:

gpsmon

This will present the following:

image.png

CGPS

Or, using the following for a simpler gps status check:

cgps

This will create the following output:

image.png

References

How to troubleshoot an NTP server: https://support.ntp.org/Support/TroubleshootingNTP

Here’s a good reference on how to tune and configure the NTP setup on a RaspBerry PI: Building a Raspberry-Pi Stratum-1 NTP Server

Another reference: Millisecond accurate Chrony NTP with a USB GPS for $12 USD - Austin's Nerdy Things

Good reference on the Shared Memory Driver, and how the 127.127.28.x address is used: http://doc.ntp.org/archives/drivers/driver28/