Differences

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

Link to this comparison view

Both sides previous revision Previous revision
ntp:timepi [2021/02/25 12:58]
john removed
— (current)
Line 1: Line 1:
-====== TimePi - GPS Disciplined Raspberry Pi NTP Server ====== 
-This is a disorganized pile of junk at the moment. Sorry. 
  
-===== System Level Stuff ===== 
- 
-==== /etc/default/gpsd ==== 
-<code> 
-START_DAEMON="true" 
-GPSD_OPTIONS="-n" 
-DEVICES="/dev/ttyAMA0" 
-USBAUTO="true" 
-GPSD_SOCKET="/var/run/gpsd.sock" 
-</code> 
- 
-==== config.txt ==== 
-<code> 
-gpu_mem=32M 
-disable_splash=1 
-dtparam=audio=off 
-dtparam=i2c_arm=off 
-dtparam=i2c1=off 
-dtparam=spi=off 
-enable_uart=1 
-dtoverlay=pps-gpio,gpiopin=4 
-dtoverlay=disable-wifi 
-dtoverlay=disable-bt 
-init_uart_baud=9600 
-arm_freq=700 
-force_turbo=1 
-</code> 
- 
-===== NTPd ===== 
- 
-==== ntpd.conf ==== 
-<code> 
-driftfile /var/lib/ntp/ntp.drift 
- 
-leapfile /usr/share/zoneinfo/leap-seconds.list 
- 
-# Enable this if you want statistics to be logged. 
-#statsdir /var/log/ntpstats/ 
-statsdir /mnt/dietpi_userdata/ntpstats 
- 
-statistics loopstats peerstats 
-filegen loopstats file loopstats type day enable 
-filegen peerstats file peerstats type day enable 
- 
-# SHM driver 
-server 127.127.28.0  minpoll 4 maxpoll 4 
-fudge 127.127.28.0 time1 0.0 refid GPS  stratum 15 
- 
-# Kernel-mode PPS ref-clock for the precise seconds 
-server 127.127.22.0 minpoll 4 maxpoll 4 
-fudge 127.127.22.0  refid PPS 
- 
-server time-a-g.nist.gov prefer 
-server time-a-wwv.nist.gov prefer 
- 
-# By default, exchange time with everybody, but don't allow configuration. 
-restrict -4 default kod notrap nomodify nopeer noquery limited 
-restrict -6 default kod notrap nomodify nopeer noquery limited 
- 
-# Local users may interrogate the ntp server more closely. 
-restrict 127.0.0.1 
-restrict ::1 
- 
-# Needed for adding pool entries 
-restrict source notrap nomodify noquery 
-</code> 
- 
-==== /etc/udev/rules.d/99-gps.rules ==== 
-(I don't know if this is actually needed, I don't think it is anymore?) 
-<code> 
-KERNEL=="pps0",SYMLINK+="gpspps0" 
-KERNEL=="ttyAMA0", SYMLINK+="gps0" 
-</code> 
- 
- 
-===== Chrony ===== 
-Chrony has some advantages over NTPd. 
- 
-  * https://wiki.alpinelinux.org/wiki/Chrony_and_GPSD 
-  * https://forristal.org/blog/2018/01/making-a-raspberry-pi-stratum-1-clock/ 
-  * https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html 
- 
- 
-However, the version packaged for Debian/Ubuntu seems to be broken in that SOCKs don't work. If you manually compile and install it you'll be good. 
- 
-==== Compile & Install ==== 
-This assumes a brand new debian-based install. 
-<code> 
-sudo apt install git bison build-essential asciidoctor -y 
-git clone https://github.com/mlichvar/chrony 
-cd chrony 
-./configure 
-make ; make docs 
-sudo make install 
-</code> 
- 
-==== chronyd.service ==== 
-A systemd service file is not included, here's a very simple one. 
- 
-<code> 
-[Unit] 
-Description=chrony, an NTP client/server 
-Documentation=man:chronyd(8) man:chronyc(1) man:chrony.conf(5) 
-Conflicts=openntpd.service ntp.service ntpsec.service 
-Wants=time-sync.target 
-Before=time-sync.target 
-After=network.target 
- 
-[Service] 
-Type=forking 
-ExecStart=/usr/local/sbin/chronyd -f /etc/chrony.conf 
- 
-[Install] 
-Alias=chronyd.service 
-WantedBy=multi-user.target 
-</code> 
- 
- 
-Install: 
-<code> 
-cp chronyd.service /lib/systemd/system/ 
-sudo systemctl daemon-reload 
-sudo systemctl enable chronyd 
-</code> 
- 
-<note important>Make sure After=chronyd.service is in the [Unit] section of gpsd.service. Chronyd must be started first because it creates the sock that gpsd writes to.</note> 
- 
-==== chrony.conf ==== 
-<code> 
-server time-a.nist.gov 
-server time-a-wwv.nist.gov 
-server time-a-b.nist.gov 
- 
-refclock SOCK /run/chrony.ttyAMA0.sock refid GPS 
- 
-rtcsync 
- 
-logchange 0.5 
- 
-local stratum 10 
- 
-makestep 1.0 3 
- 
-logdir /var/log/chrony 
- 
-dumpdir /var/log/chrony 
-driftfile /var/log/chrony/chrony.drift 
- 
-allow</code> 
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0