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
Last revisionBoth sides next revision
stratum1ntp [2019/07/24 16:27] andrewstratum1ntp [2021/10/22 20:35] 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
   * Setup rpi with latest Raspbian, enable ssh, etc...   * Setup rpi with latest Raspbian, enable ssh, etc...
   * apt-get install vim   * apt-get install vim
   * 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
Line 33: Line 36:
   * 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 46: Line 50:
 #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 88: Line 93:
 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 108: Line 113:
  
 # 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 127: Line 135:
     * 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.txt · Last modified: 2021/11/28 02:51 by andrew
Back to top
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0