My NTP Servers


There probably aren't many GPS antennas on completely stationary suburban single family homes out there...

I run various stratum 1 NTP servers at home. In the past I used Soekris SBC's. They made for excellent NTP servers, but they are long discontined and most recent O/S's will not run on them without a fair amount of challenge. I now use Raspberry Pi's. At the moment (Oct 2022), these include:

tick

  • Hardware: Raspberry Pi "B" v2, Adafruit GPS board
  • Software: Raspbian, GPSd, NTPsec, shm reference driver
  • Graphs: day week

tock

  • Hardware: Raspberry Pi 4 (1gb), u-Blox GPS
  • Software: Raspbian, GPSd, chronyd
  • Graphs: day week

I also have two commercial devices - a (very old) Spectracom 9183 and a CenterClick NTP200. All are fed by a single active Symmetricom GPS antenna (mounted just above the roofline, see right) and a 4-way splitter.

But why?

Why not?

Build notes

Note: These notes are based on older versions of Raspbian and may need tweaked. Also, for modern devices (Pi3 and above), you'll want to disable bluetooth and enable GPIO serial.

  • Add to /boot/cmdline.txt:
    nohz=off
  • Enable PPS by adding the following to /boot/config.txt. Pin 18 is the 6th over on the top row. The third pin is ground. 3.3v logic
    dtoverlay=pps-gpio,gpiopin=18
  • Install necessary packages:
    sudo apt install cpufrequtils pps-tools git scons libncurses-dev python-dev bc bison libcap-dev libssl-dev libreadline-dev
  • Add to /etc/default/cpufrequtils:
    GOVERNOR="performance"
  • Disable unnecessary services:
    for i in systemd-timesyncd avahi-daemon alsa-state bluetooth triggerhappy hciuart rng-tools autologin getty;
    do
       systemctl disable $i.service; systemctl stop $i.service; 
    done
  • Add to /etc/udev/rules.d/10-pps.rules (replace ttyACM0 with actual serial port of gps:
    KERNEL=="ttyACM0", SYMLINK+="gpsd0"
  • Build gpsd:
    git clone git://git.savannah.nongnu.org/gpsd.git
    cd gpsd
    scons timeservice=yes nmea0183=yes ublox=yes gpsdclients=yes python=yes fixed_port_speed=9600 fixed_stop_bits=1
    sudo scons install
    
  • Build ntpsec:
    git clone https://gitlab.com/NTPsec/ntpsec.git
    cd ntpsec
    ./waf configure --refclock=shm,gpsd,pps
    ./waf build
    sudo ./waf install
    
  • Add ntp user and group:
    sudo adduser --system --no-create-home --disabled-login --gecos '' ntp
    sudo addgroup --system ntp
    sudo addgroup ntp ntp
    sudo mkdir -p /var/lib/ntp /var/log/ntpstats
    sudo chown -R ntp:ntp /var/lib/ntp /var/log/ntpstats
    
  • Add the following to /etc/default/gpsd:
    OPTIONS="-G"
    DEVICES="/dev/gpsd0"
    
  • Grab sample /etc/ntpd.conf from here
  • Grab unit files from here and put them in /etc/systemd/system

Links