Saturday, January 31, 2015

Ubuntu 14.04 LTS - Howto setup NTP working with GPS

http://www.catb.org/gpsd/gpsd-time-service-howto.html#_feeding_ntpd_from_gpsd

I've been wanting to rely less on having Internet access with the "Driveby System".  There's a long way to go on that front yet.  However, today I was able to leverage two things I already had installed to accomplish a simple task.  The two computers I used in this system do not use a battery backed-up on board clock.  Which has meant that I required internet access to global time servers in order to set the clocks accurately.  

"Driveby" requires that all systems use as close the same time as possible, because in my case the GPS lat/long's are being recorded on one server, while the RTL noise floor reading are being logged on another server.  In order to line them up properly (to know where a noise floor reading came from accurately) the two system clocks must be in sync.

So today I finally got this setup and working properly on the GPS connected server following the directions noted in the link above.

--------

The next task is to get the Odroid to use the TK1 (the one with the GPS/NTP setup now) as it's NTP server.  Thus keeping the two systems in time sync.

UPDATE this is completed, and working.  Both servers time are being kept in sync using NTP and the TK1 is getting it's time from the GPS.  Case close.  Whew...VERY cool!  And fairly simple.

SERVER (GPS attached) SIDE /etc/ntp.conf

pool us.pool.ntp.org iburst

driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 mask 255.255.255.0
restrict -6 ::1
restrict 10.0.1.0 mask 255.255.255.0 nomodify notrap

# GPS Serial data reference
server 127.127.28.0
fudge 127.127.28.0 time1 0.9999 refid GPS

# GPS PPS reference
server 127.127.28.1 prefer

fudge 127.127.28.1 refid PPS

CLIENT SIDE /etc/ntp/conf
(Similar to the installed version with one line change)

driftfile /var/lib/ntp/ntp.drift
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
# Use Ubuntu's ntp server as a fallback.
server 10.0.1.2
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1