Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste ÜberarbeitungBeide Seiten der Revision
linux:zeitsynchronisation_mit_dcf-77_empfaenger [2017/07/26 06:48] – angelegt adilinux:zeitsynchronisation_mit_dcf-77_empfaenger [2021/07/14 12:12] adi
Zeile 8: Zeile 8:
 ===== Conrad Stückliste ===== ===== Conrad Stückliste =====
 PC-Funkuhrmodul          Teileliste mit Conrad-Artikelnr. PC-Funkuhrmodul          Teileliste mit Conrad-Artikelnr.
-  +
- +
 ^ Anzahl ^ Beschreibung ^ Artikel-Nr ^ Preis/Stck ^ Preis ges. ^ ^ Anzahl ^ Beschreibung ^ Artikel-Nr ^ Preis/Stck ^ Preis ges. ^
 |1 |DCF77-Modul von Conrad-Elektronik |641138 |10,21 |10,21 | |1 |DCF77-Modul von Conrad-Elektronik |641138 |10,21 |10,21 |
Zeile 26: Zeile 25:
 |1 |Lochrasterplatine |528404-62 |0,63 |0,63 | |1 |Lochrasterplatine |528404-62 |0,63 |0,63 |
 |1 |Gehäuse |520521-62 |2,71 |2,71 | |1 |Gehäuse |520521-62 |2,71 |2,71 |
-| | | | | |                                                           +| |  **Gesamt Preise**| |**18,53** |**19,38** | 
-| | | | | | +
-| |  **Gesamt preise**| |**18,53** |**19,38** | +
-  +
- +
 ===== Schaltung ===== ===== Schaltung =====
 Dazugehörige Schaltung: Dazugehörige Schaltung:
Zeile 37: Zeile 33:
    
 ===== Software ===== ===== Software =====
-Unter linux kann mit dem NTP Daemon die Zeit des Funkuhrmoduls empfangen und konvertiert werden.+Unter Linux kann mit dem NTP Daemon die Zeit des Funkuhrmoduls empfangen und konvertiert werden.
  
 ==== NTP ==== ==== NTP ====
Zeile 43: Zeile 39:
 <code bash>apt-get install ntp ntpdate refclock</code> <code bash>apt-get install ntp ntpdate refclock</code>
    
-In der NTP.conf (''/etc/ntp.conf''dann noch die folgenden Zeilen einfügen:+In der ''/etc/ntp.conf'' dann noch die folgenden Zeilen anpassen:
    
-<code bash>  # /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help+<code bash># /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
    
-  driftfile /var/lib/ntp/ntp.drift +driftfile /var/lib/ntp/ntp.drift 
-  logfile /var/log/ntp.log +logfile /var/log/ntp.log 
-  + 
-  # Enable this if you want statistics to be logged. +# Enable this if you want statistics to be logged. 
-  statsdir /var/log/ntpstats/ +statsdir /var/log/ntpstats/ 
-  + 
-  statistics loopstats peerstats clockstats +statistics loopstats peerstats clockstats 
-  filegen loopstats file loopstats type day enable +filegen loopstats file loopstats type day enable 
-  filegen peerstats file peerstats type day enable +filegen peerstats file peerstats type day enable 
-  filegen clockstats file clockstats type day enable +filegen clockstats file clockstats type day enable 
-  + 
-  + 
-  # You do need to talk to an NTP server or two (or three). +# You do need to talk to an NTP server or two (or three). 
-  #server ntp.ubuntu.com +#server ntp.ubuntu.com 
-  server 127.127.8.0 mode 5 prefer +server 127.127.8.0 mode 5 prefer 
-  server 127.127.1.0 +server 127.127.1.0 
-  fudge 127.127.1.0 stratum 10 +fudge 127.127.1.0 stratum 10 
-  + 
-  # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for +# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for 
-  # details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions> +# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions> 
-  # might also be helpful. +# might also be helpful. 
-  +
-  # Note that "restrict" applies to both servers and clients, so a configuration +# Note that "restrict" applies to both servers and clients, so a configuration 
-  # that might be intended to block requests from certain clients could also end +# that might be intended to block requests from certain clients could also end 
-  # up blocking replies from your own upstream servers. +# up blocking replies from your own upstream servers. 
-  + 
-  # By default, exchange time with everybody, but don't allow configuration. +# By default, exchange time with everybody, but don't allow configuration. 
-  restrict -4 default kod notrap nomodify nopeer noquery +restrict -4 default kod notrap nomodify nopeer noquery 
-  restrict -6 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery 
-  + 
-  # Local users may interrogate the ntp server more closely. +# Local users may interrogate the ntp server more closely. 
-  restrict 127.0.0.1 +restrict 127.0.0.1 
-  restrict ::1 +restrict ::1 
-  # Clients from this (example!) subnet have unlimited access, but only if +# Clients from this (example!) subnet have unlimited access, but only if 
-  # cryptographically authenticated. +# cryptographically authenticated. 
-  #restrict 192.168.123.0 mask 255.255.255.0 notrust +#restrict 192.168.123.0 mask 255.255.255.0 notrust 
-  + 
-  + 
-  # If you want to provide time to your local subnet, change the next line. +# If you want to provide time to your local subnet, change the next line. 
-  # (Again, the address is an example only.) +# (Again, the address is an example only.) 
-  #broadcast 192.168.123.255 +#broadcast 192.168.123.255 
-  + 
-  # If you want to listen to time broadcasts on your local subnet, de-comment the +# If you want to listen to time broadcasts on your local subnet, de-comment the 
-  + 
-  # next lines.  Please do this only if you trust everybody on the network! +# next lines.  Please do this only if you trust everybody on the network! 
-  #disable auth +#disable auth 
-  #broadcastclient</code>+#broadcastclient</code>
    
 ==== Udev Rules ==== ==== Udev Rules ====
-Damit der Eintrag ''server 127.127.8.0 mode 5 prefer'' auch funktioniert muss +Damit der Eintrag ''server 127.127.8.0 mode 5 prefer'' auch funktioniertmuss ein Link auf ''/dev/ttyS0'' (COM-Port 1) gesetzt werden.
-ein Link auf ''/dev/ttyS0'' (COM-Port 1) gesetzt werden.+
 <code bash>ln -s /dev/ttyS0 /dev/refclock-0</code> <code bash>ln -s /dev/ttyS0 /dev/refclock-0</code>
    
 Dieser Link sollte auch nach einem Reboot noch da sein. Dies ist er aber nicht wenn wir nicht die UDEV-Rules bearbeiten: Dieser Link sollte auch nach einem Reboot noch da sein. Dies ist er aber nicht wenn wir nicht die UDEV-Rules bearbeiten:
-Also mit ''vi'' die Datei (evtl. noch nicht vorhanden) ''/etc/udev/ruldes.d/75-refclock.rules'' öffnen und folgende Zeile einfügen:+Also die Datei (evtl. noch nicht vorhanden) ''/etc/udev/ruldes.d/75-refclock.rules'' öffnen und folgende Zeile einfügen:
 <code bash>KERNEL=="ttyS0",SYMLINK+="refclock-0",MODE="0777"</code> <code bash>KERNEL=="ttyS0",SYMLINK+="refclock-0",MODE="0777"</code>
    
Zeile 113: Zeile 108:
 <code>/dev/ttyS0 rwl, <code>/dev/ttyS0 rwl,
 /dev/refclock-0 rwl,</code> /dev/refclock-0 rwl,</code>
- +
 ===== Test ===== ===== Test =====
 Nun kann der NTP-Daemon mit dem Befehl ''service ntp restart'' neugestartet werden. Nun kann der NTP-Daemon mit dem Befehl ''service ntp restart'' neugestartet werden.
Zeile 130: Zeile 125:
    
 Hier eine Ausgabe: Hier eine Ausgabe:
-<code>  11 May 09:24:00 ntpd[2162]: ntpd exiting on signal 15 +<code>11 May 09:24:00 ntpd[2162]: ntpd exiting on signal 15 
-  11 May 09:24:55 ntpd[2297]: parse: convert_rawdcf: INCOMPLETE DATA - time code only has 51 bits +11 May 09:24:55 ntpd[2297]: parse: convert_rawdcf: INCOMPLETE DATA - time code only has 51 bits 
-  + 
-  11 May 09:24:55 ntpd[2297]: PARSE receiver #0: interval for following error message class is at least 00:01:00 +11 May 09:24:55 ntpd[2297]: PARSE receiver #0: interval for following error message class is at least 00:01:00 
-  11 May 09:24:55 ntpd[2297]: PARSE receiver #0: FAILED TIMECODE: "----#----#--#-#R--M-S1--8---P---8--P-2-8------2---" (check receiver configuration / wiring) +11 May 09:24:55 ntpd[2297]: PARSE receiver #0: FAILED TIMECODE: "----#----#--#-#R--M-S1--8---P---8--P-2-8------2---" (check receiver configuration / wiring) 
-  11 May 09:25:58 ntpd[2297]: synchronized to GENERIC(0), stratum 0 +11 May 09:25:58 ntpd[2297]: synchronized to GENERIC(0), stratum 0 
-  11 May 09:27:03 ntpd[2297]: time reset +64.490872 s +11 May 09:27:03 ntpd[2297]: time reset +64.490872 s 
-  11 May 09:27:03 ntpd[2297]: kernel time sync status change 2001 +11 May 09:27:03 ntpd[2297]: kernel time sync status change 2001 
-  11 May 09:27:04 ntpd[2297]: parse: convert_rawdcf: INCOMPLETE DATA - time code only has 4 bits+11 May 09:27:04 ntpd[2297]: parse: convert_rawdcf: INCOMPLETE DATA - time code only has 4 bits 
 + 
 +11 May 09:27:04 ntpd[2297]: PARSE receiver #0: interval for following error message class is at least 00:01:00 
 +11 May 09:27:04 ntpd[2297]: PARSE receiver #0: FAILED TIMECODE: "--#" (check receiver configuration / wiring) 
 +11 May 09:28:00 ntpd[2297]: parse: convert_rawdcf: INCOMPLETE DATA - time code only has 55 bits 
 + 
 +11 May 09:29:03 ntpd[2297]: synchronized to GENERIC(0), stratum 0</code>
    
-  11 May 09:27:04 ntpd[2297]: PARSE receiver #0: interval for following error message class is at least 00:01:00 +Man sieht dass in der 1. Zeile der Neustart des Daemon angezeigt wird.
-  11 May 09:27:04 ntpd[2297]: PARSE receiver #0: FAILED TIMECODE: "--#" (check receiver configuration / wiring) +
-  11 May 09:28:00 ntpd[2297]: parse: convert_rawdcf: INCOMPLETE DATA - time code only has 55 bits +
-  +
-  11 May 09:29:03 ntpd[2297]: synchronized to GENERIC(0), stratum 0</code> +
-  +
-Man sieht dass in der 1. Zeile der neustart des Daemon angezeigt wird.+
 Danach erhält der NTP die Signale des Empfängers. Danach erhält der NTP die Signale des Empfängers.
 Das ''INCOMPLETE DATA'' ist soweit ok, denn das Funkuhrmodul bracht ca. 1 Minute bis es die korrekte Zeit liefert. Das ''INCOMPLETE DATA'' ist soweit ok, denn das Funkuhrmodul bracht ca. 1 Minute bis es die korrekte Zeit liefert.
Zeile 153: Zeile 148:
 Man kann mit dem Befehl ''date'' kontrollieren ob die richtige Zeit im System vorhanden ist. Man kann mit dem Befehl ''date'' kontrollieren ob die richtige Zeit im System vorhanden ist.
  
 +===== timesyncd =====
 +Quelle: [[https://wiki.archlinux.org/title/systemd-timesyncd]]
 +
 +Timesyncd ist ein anderer Zeitdienst-Daemon unter Linux.
 +
 +Dieser wird in dieser Datei Konfiguriert ''/etc/systemd/timesyncd.conf''.
 +
 +Beispiel: <code>[Time]
 +#NTP= ntp1.domain.tld ntp2.domain.tld ...
 +#FallbackNTP=ntp3.domain.tld ntp4.domain.tld ...
 +#RootDistanceMaxSec=5
 +#PollIntervalMinSec=32
 +#PollIntervalMaxSec=2048</code>
 +
 +Gestartet wird Timesync mit dem Befehl ''systemctl start systemd-timesyncd.service'', oder einfach einschalten per ''timedatectl set-ntp true''
 +
 +Diese Befehle zeigen die aktuellen Einstellungen und Laufzeitdaten: <code bash>timedatectl show-timesync --all
 +timedatectl status
 +timedatectl timesync-status</code>
Navigation
Drucken/exportieren
QR-Code
QR-Code Zeitsynchronisation Mit DCF-77 Empfänger (erstellt für aktuelle Seite)