国内外厂商制造的高精度时钟服务器实际都是基于x86服务器,加装铷钟和GPS接收模块构成。树莓派流行起来后,网上也有配套的模块,让大家可以制造一个小巧的时钟服务器。实际这淘宝上有很多USB接口的GPS接收模块,产品特性:GPS+GLONASS双模定位内置FLASH,USB供电自适应1200-921600波特率1Hz输出,NMEA-0183协议输出。NTPD是业内对各种GPS接受器支持的最好的,绝大部分GPS接受模块实际都是使用标准的NMEA协议从/dev/gps输出。
测试的配置如下:
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
logfile /var/log/ntp.log driftfile /var/lib/ntp/drift
Permit time synchronization with our time source, but do not
permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
Permit all access over the loopback interface. This could
be tightened as well, but to do so would effect some of
the administrative functions.
restrict 127.0.0.1 restrict ::1
Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 127.127.20.1 mode 17 minpoll 4 maxpoll 4 fudge 127.127.20.1 stratum 0 refid GPS flag1 1 flag2 0 flag3 1 server 127.127.1.1 minpoll 4 maxpoll 4 fudge 127.127.1.1 stratum 1 refid LCK
Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
Key file containing the keys and key identifiers used when operating
with symmetric key cryptography.
keys /etc/ntp/keys
Specify the key identifiers which are trusted.
#trustedkey 4 8 42
Specify the key identifier to use with the ntpdc utility.
#requestkey 8
Specify the key identifier to use with the ntpq utility.
#controlkey 8
Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
Disable the monitoring facility to prevent amplification attacks using ntpdc
monlist command when default restrict does not include the noquery flag. See
CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor