Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
stratum1ntp [2019/07/24 16:28] andrewstratum1ntp [2021/11/28 02:51] (current) andrew
Line 1: Line 1:
 ====== Stratum 1 NTP Setup on Raspberry Pi ====== ====== Stratum 1 NTP Setup on Raspberry Pi ======
 +== By: Bun-Bun & guppy ==
 +
   * This guides uses Uputronics Raspberry Pi+ GPS Expansion Board and a rpi3 or newer   * This guides uses Uputronics Raspberry Pi+ GPS Expansion Board and a rpi3 or newer
   * Setup rpi with latest Raspbian, enable ssh, etc...   * Setup rpi with latest Raspbian, enable ssh, etc...
Line 5: Line 7:
   * raspi-config #disable linux from trying to access console getty   * raspi-config #disable linux from trying to access console getty
     * 5 Interfacing Options      * 5 Interfacing Options 
-    * P6 Serial -> Login Shell (no) +    * P6 Serial -> Login Shell (no) -> Enable Hardware (yes)
   * vi /boot/config.txt   * vi /boot/config.txt
     * Add the following to the bottom     * Add the following to the bottom
     * <code>enable_uart=1     * <code>enable_uart=1
 +dtoverlay=pi3-disable-wifi
 dtoverlay=pi3-disable-bt #same with rpi4 dtoverlay=pi3-disable-bt #same with rpi4
 #dtoverlay=pi3-miniuart-bt #if you want software BT #dtoverlay=pi3-miniuart-bt #if you want software BT
Line 34: Line 37:
   * vi /etc/ntp.conf   * vi /etc/ntp.conf
     * Change servers as appropriate, stuff at the bottom is the gpsd and pps link     * Change servers as appropriate, stuff at the bottom is the gpsd and pps link
 +    * Can have no servers and only use gps/pps as source, or have more than 1 other. Two sources (yourself and some other server) is bad.
     * <code>     * <code>
 # Enable this if you want statistics to be logged. # Enable this if you want statistics to be logged.
Line 47: Line 51:
 #server ntp.your-provider.example #server ntp.your-provider.example
  
 +#Can have no servers and only use gps/pps as source, or have more than 1 other. Two sources (yourself and some other server) is bad.
 #server tock.usask.ca #server tock.usask.ca
 #server ntp2.torix.ca #server ntp2.torix.ca
-server ntp.zaf.ca+#server ntp.zaf.ca
  
 # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
Line 89: Line 94:
 server 127.127.28.0 minpoll 4 maxpoll 4 iburst prefer server 127.127.28.0 minpoll 4 maxpoll 4 iburst prefer
 fudge 127.127.28.0 time1 +0.105 flag1 1 refid GPSD stratum 1 fudge 127.127.28.0 time1 +0.105 flag1 1 refid GPSD stratum 1
-tos mindist 0.015 #something about ignoring a certain amount of jitter from shitty sources+tos mindist 0.015 #something about accepting a certain amount of jitter from serial sources
 </code> </code>
   * apt-get install gpsd gpsd-clients   * apt-get install gpsd gpsd-clients
Line 109: Line 114:
  
 # Other options you want to pass to gpsd # Other options you want to pass to gpsd
-GPSD_OPTIONS=-n""+GPSD_OPTIONS="-n"
 </code> </code>
   * {{ntpsetup.tar|gpsControl files and install.sh}} #for stationary mode (Credit to guppy for creating and Bun-Bun for correcting)   * {{ntpsetup.tar|gpsControl files and install.sh}} #for stationary mode (Credit to guppy for creating and Bun-Bun for correcting)
     * Download linked tar     * Download linked tar
 +      * wget -O ntpsetup.tar http://wiki.sktechworks.ca/lib/exe/fetch.php?media=ntpsetup.tar
     * tar -xvf ntpsetup.tar     * tar -xvf ntpsetup.tar
-    * cd ntpsetup.tar+    * cd ntpsetup
     * ./install.sh     * ./install.sh
     * This copies the gpscontrol files and creates/enables its service. Also makes a gpsd requirement for ntp     * This copies the gpscontrol files and creates/enables its service. Also makes a gpsd requirement for ntp
   * Disable NTP from dhcp   * Disable NTP from dhcp
-    * echo "" > /etc/dhcp/dhclient-exit-hooks.d/ntp +    * <code> 
-    echo "" > /var/lib/ntp/ntp.conf.dhcp +echo "" > /etc/dhcp/dhclient-exit-hooks.d/ntp 
-    chattr +i /etc/dhcp/dhclient-exit-hooks.d/ntp +echo "" > /var/lib/ntp/ntp.conf.dhcp 
-    chattr +i /var/lib/ntp/ntp.conf.dhcp+chattr +i /etc/dhcp/dhclient-exit-hooks.d/ntp 
 +chattr +i /var/lib/ntp/ntp.conf.dhcp 
 +</code>
   * reboot   * reboot
   * gpsmon #also cgps -s   * gpsmon #also cgps -s
Line 128: Line 136:
     * http://www.unixwiz.net/techtips/raspberry-pi3-gps-time.html     * http://www.unixwiz.net/techtips/raspberry-pi3-gps-time.html
     * https://ava.upuaut.net/?p=951     * https://ava.upuaut.net/?p=951
 +
 +====== Optimizations ======
 +
 +  * https://www.ntpsec.org/white-papers/stratum-1-microserver-howto/
 +  * Add nohz=off to the end of the line in /boot/cmdline.txt
 +  * configure system to run cpu full speed
 +    * <code>apt -y install cpufrequtils
 +echo 'GOVERNOR="performance"' > /etc/default/cpufrequtils
 +systemctl restart cpufrequtils</code>
 +  * Remove useless stuff
 +    * <code>apt -y purge bluez triggerhappy wpasupplicant alsa-utils
 +systemctl stop avahi-daemon
 +systemctl disable avahi-daemon
 +apt -y autoremove
 +apt clean
 +</code>
 +  * Set serial to low latency
 +    * <code>crontab -e
 +@reboot setserial /dev/ttyAMA0 low_latency
 +</code>
  
stratum1ntp.1563985701.txt.gz · Last modified: 2019/07/24 16:28 by andrew
Back to top
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0