My NTP Servers

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 2019), 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 LEA-5T timing GPS
  • Software: Raspbian, GPSd, NTPsec, shm reference driver
  • Graphs: day week

Build notes

  • 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