Saturday, January 31, 2015

Ubuntu 14.04 LTS - Howto setup NTP working with GPS

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 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 mask
restrict -6 ::1
restrict mask nomodify notrap

# GPS Serial data reference
fudge time1 0.9999 refid GPS

# GPS PPS reference
server prefer

fudge 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 for
# more information.
# Use Ubuntu's ntp server as a fallback.
# 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 ::1

No comments:

Post a Comment