alix_voyage_linux_ntp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
alix_voyage_linux_ntp [2015/02/13 14:33] – admin | alix_voyage_linux_ntp [2020/01/01 14:09] (current) – removed admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{tag> | ||
- | ~~TOC~~ | ||
- | =====PC Engines Alix 1E - Hopf NTP Server===== | ||
- | |||
- | ====Create device symlinks==== | ||
- | ===Hopf=== | ||
- | < | ||
- | cd / | ||
- | cat hopf.rules | ||
- | KERNEL==" | ||
- | KERNEL==" | ||
- | KERNEL==" | ||
- | </ | ||
- | |||
- | ===GPS / PPS=== | ||
- | < | ||
- | cat pps.rules | ||
- | KERNEL==" | ||
- | KERNEL==" | ||
- | KERNEL==" | ||
- | KERNEL==" | ||
- | KERNEL==" | ||
- | </ | ||
- | |||
- | ====Compile NTP==== | ||
- | < | ||
- | (apt-get remove ntp) | ||
- | |||
- | cd /root | ||
- | apt-get install dpkg-dev dialog devscripts fakeroot pps-utils | ||
- | | ||
- | apt-get source ntp && apt-get build-dep ntp | ||
- | | ||
- | cd ntp< | ||
- | | ||
- | debuild -us -uc | ||
- | | ||
- | dpkg --install ntp....deb | ||
- | </ | ||
- | |||
- | ====Configuration==== | ||
- | * Allow write to drift file, edit **/ | ||
- | * Set hwclock, edit **/ | ||
- | * Load module rtc. < | ||
- | rtc</ | ||
- | * Configure locale. < | ||
- | dpkg-reconfigure locales</ | ||
- | * Run the ntpd at the highest priority. < | ||
- | |||
- | NTPD_OPTS=' | ||
- | |||
- | ====Hopf DCF / | ||
- | < | ||
- | tos orphan 12 | ||
- | |||
- | # Hopf DCF clock | ||
- | server 127.127.8.0 mode 12 minpoll 4 maxpoll 4 | ||
- | fudge 127.127.8.0 | ||
- | fudge 127.127.8.0 flag1 1 # Time2 = Trust time | ||
- | fudge 127.127.8.0 time2 3600 # Trust time | ||
- | |||
- | leapfile / | ||
- | |||
- | restrict -4 default kod notrap nomodify nopeer noquery | ||
- | restrict -6 default kod notrap nomodify nopeer noquery | ||
- | restrict 127.0.0.1 | ||
- | restrict ::1 | ||
- | |||
- | statsdir / | ||
- | 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 | ||
- | |||
- | driftfile / | ||
- | |||
- | ====Nagios Hopf 7001 check==== | ||
- | < | ||
- | # | ||
- | # Tested with Hopf 7001 DCF Base station with 7245 serial interface boards | ||
- | # Datastring 7001/6021 | ||
- | # | ||
- | # Ben Stienstra, 2013/05 | ||
- | |||
- | ntpq="/ | ||
- | |||
- | # get timecode variable, received from the clock | ||
- | eval `$ntpq -c 'cv 0 timecode' | ||
- | |||
- | function quit { | ||
- | case " | ||
- | 0) echo "OK: $1" | ||
- | exit 0 | ||
- | ;; | ||
- | 1) echo " | ||
- | exit 1 | ||
- | ;; | ||
- | 2) echo " | ||
- | exit 2 | ||
- | ;; | ||
- | 3) echo " | ||
- | exit 3 | ||
- | ;; | ||
- | esac | ||
- | } | ||
- | |||
- | function clockstat { | ||
- | # Status nibble from hex | ||
- | hex0=0000 | ||
- | hex1=0001 | ||
- | hex2=0010 | ||
- | hex3=0011 | ||
- | hex4=0100 | ||
- | hex5=0101 | ||
- | hex6=0110 | ||
- | hex7=0111 | ||
- | hex8=1000 | ||
- | hex9=1001 | ||
- | hexA=1010 | ||
- | hexB=1011 | ||
- | hexC=1100 | ||
- | hexD=1101 | ||
- | hexE=1110 | ||
- | hexF=1111 | ||
- | |||
- | eval statnibble=' | ||
- | snibble=${!statnibble} | ||
- | |||
- | case ${snibble: | ||
- | 00) | ||
- | textstatus=" | ||
- | exitcode=2 | ||
- | ;; | ||
- | 01) | ||
- | textstatus=" | ||
- | exitcode=1 | ||
- | ;; | ||
- | 10) | ||
- | textstatus=" | ||
- | exitcode=0 | ||
- | ;; | ||
- | 11) | ||
- | textstatus=" | ||
- | exitcode=0 | ||
- | ;; | ||
- | esac | ||
- | |||
- | case ${snibble: | ||
- | 0) | ||
- | dss=" | ||
- | ;; | ||
- | 1) | ||
- | dss=" | ||
- | ;; | ||
- | esac | ||
- | |||
- | case ${snibble: | ||
- | 0) | ||
- | ann=" | ||
- | ;; | ||
- | 1) | ||
- | ann=" | ||
- | ;; | ||
- | esac | ||
- | |||
- | quit " | ||
- | } | ||
- | |||
- | |||
- | # check for complete string, for example: \x028D194223310513\x0a\x0d\x03 | ||
- | # This is from the Hopf 7245 serial interface board | ||
- | # | ||
- | # x20 = Space | ||
- | # x0D = CR (carriage return) | ||
- | # x0A = LF (line feed) | ||
- | # x02 = STX (start of text) | ||
- | # x03 = ETX (end of text) | ||
- | # | ||
- | if [[ $timecode == \\x02*\\x0a\\x0d\\x03 ]]; | ||
- | then | ||
- | clockstat ${timecode: | ||
- | else | ||
- | quit " | ||
- | fi</ | ||
- | ====Handy ntp commands==== | ||
- | * Show peer status: < | ||
- | * Show timecode from receiver: < | ||
- | * Show client list (max. 600): < | ||
- | |||
- | ## ntp 2.4.7 removed monlist in favour of ntpq's mrulist | ||
- | ntpq -c " |