我在端口/ dev / ttyS0上使用带PPS的GPS设备的ntp。 如果机器连接到互联网,似乎一切正常。 输出看起来正确。 但是,如果没有互联网连接,我会得到:
$ 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
我想因为没有o前缀GPS_NMEA不起作用。 我目前的ntpconfiguration是
# /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
如果没有互联网连接,我需要怎样configurationntp也使用GPS源。 我读过,我至less需要两个时间来源,但我认为使用PPS的GPS时间比只信任本地隔离时钟更好?
编辑
我会用它来精确的天文指向。 主要有互联网连接可用。 但有时我没有联系,也想要一个准确的时间。
我删除iburst和现在的输出
$ 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 [email protected] 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
但今天下午的第一个办法有一个不同之处。 现在我将笔记本电脑直接连接到服务器。 在第一种方法中,我通过FritzBox与服务器通信,而无需连接互联网。 正如你所看到的,第一个贴上有一个时间源项。 也许路由器导致ntpd停止,因为现在只有两个时间源? 我认为正常的情况下,将没有路由器没有互联网连接。 无论如何,我能避免这种情况吗?
从参考时钟input中取出iburst 。 您还可以对服务器条目进行以下更改:
更改:
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
至:
pool 0.ubuntu.pool.ntp.org iburst pool 1.ubuntu.pool.ntp.org iburst pool 2.ubuntu.pool.ntp.org iburst pool 3.ubuntu.pool.ntp.org iburst
并删除ntp.ubuntu.com条目。 pool指令意味着preempt所以它更容忍间歇性的networking问题。
如果其他人有这个问题,我发布了我评论中的答案。 如果这不够,请更新您的post。
我build议你添加true的服务器行,在iburst和prefer 。 true让服务器能够存活NTP的服务器algorithm除草。
# NMEA refclock driver directly from serial port within ATOM clock support (flag 1) server 127.127.20.0 mode 18 minpoll 4 maxpoll 4 true prefer fudge 127.127.20.0 flag1 1 flag2 0 flag3 1 flag4 0 time2 0.475