I use ntp with a GPS device with PPS on port /dev/ttyS0. All seems to be fine if the machine is connected to the internet. Output looks correct. But if there is no internet connection I get:
$ ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== fritz.box .INIT. 16 u - 1024 0 0.000 0.000 0.000 GPS_NMEA(0) .GPS. 0 l - 16 0 0.000 0.000 0.000
I think because there is no o prefix GPS_NMEA doesn't work. My current ntp configuration is
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help driftfile /var/lib/ntp/ntp.drift # Enable this if you want statistics to be logged. statsdir /var/log/ntpstats/ statistics clockstats 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 ntp.ubuntu.com # NMEA refclock driver directly from serial port within ATOM clock support (flag 1) server 127.127.20.0 mode 18 minpoll 4 maxpoll 4 iburst prefer fudge 127.127.20.0 flag1 1 flag2 0 flag3 1 flag4 0 time2 0.475 # 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
What do I need to configure that ntp is using the GPS source too if there is no internet connection. I read I need at least two time sources but I think using GPS time with PPS is better than just trust the local isolated clock?
I will use it for accurate astronomical pointing. Mostly there is a internet connection availible. But sometimes I have no connection and also want a accurate time.
I removed iburst and the output now is
$ ntpq -pcrv remote refid st t when poll reach delay offset jitter ============================================================================== oGPS_NMEA(0) .GPS. 0 l 7 16 377 0.000 -0.179 0.019 associd=0 status=041d leap_none, sync_uhf_radio, 1 event, kern, version="ntpd firstname.lastname@example.org Sun Oct 19 04:29:07 UTC 2014 (1)", processor="x86_64", system="Linux/3.13.0-37-generic", leap=00, stratum=1, precision=-20, rootdelay=0.000, rootdisp=0.520, refid=GPS, reftime=d7effd04.fccd2064 Mon, Oct 20 2014 23:28:36.987, clock=d7effd0b.5652112f Mon, Oct 20 2014 23:28:43.337, peer=22523, tc=4, mintc=3, offset=-0.179, frequency=6.121, sys_jitter=0.019, clk_jitter=0.000, clk_wander=0.080
But there is one difference to the first approach this afternoon. Now I connect my laptop direct to the server. In the first approach I talking to the server over a FritzBox without an internet connection. As you can see there is an time source entry in the first paste. Maybe the router causes ntpd to stop because there are only two timesources now? I think the normal case would be without a router with no internet connection. Anyway, could I avoid this situation?