The first step is to create the file ntp.conf in the directory /etc/ntpd/ under CentOS. Afterwards, the reference clock driver to be used for the Meinberg receiver module has to be stored for ntpd. This is the PARSE driver with the reference ID: PARSE, driver ID: GENERIC and is addressed via the IP address 127.127.8.0. The PARSE driver always expects the interface /dev/refclock-0. If this is not available, a symbolic link between the actual serial interface (e.g. /dev/ttyS0) and the PARSE driver interface must be created. This can be done under CentOS via an udev-rule.
In order for the ntpd daemon to be able to address the PARSE driver correctly, the following configuration options must be entered in the ntpd.conf file:
# The PARSE reference clock driver to handle MEINBERG DCF77 receiver
server 127.127.8.0 mode 2
The parameter server 127.127.8.0 mode 2 causes the ntp daemon to address the PARSE driver in mode 2 (serial interface /dev/refclock-0 with 9600 7E2) and to evaluate the DCF77 signal correctly. In addition, it is recommended to switch to the server's own clock in case of a total failure of the Meinberg clock. This can be configured as follows.
# Now the local clock which is fall-back, if DCF77 is offline...
server 127.127.1.0
fudge 127.127.1.0 stratum 10
The lines listed in the example ensure that in the event of a total failure of the Meinberg receiver module, the ntp daemon does not quit its service, but switches to the system clock and continues its service as a stratum 10 server.
A example configuration for a Stratum 1 server
#/bin/sh
#
# @(#)make 1.2 (maj) 2009/11/16
# Main configuration file for Stratum 1 ntp daemon
#
# Author: Jens Mahnke, ()
# Copyright (c) 2009 All rights reserved.
#
# --- GENERAL CONFIGURATION ---
# First, the GENERIC clock referecne driver.
# It supports the Meinberg DCF77-C51 in their defaults, which are
# serial line connected, 9600 bits, 7E2.
# The settings are 'server 127.127.8.0 mode 2'
server 127.127.8.0 mode 2
# --- Fallback Configuration if DCF77 signal offline ---
# the local clock as Stratum 10 which is fall-back, if DCF77 is offline...
server 127.127.1.0
fudge 127.127.1.0 stratum 10
# --- Online Server as Backup Configuration ---
# server ptbtime2.ptb.de iburst minpoll 6 maxpoll 8
# server 192.53.103.108 prefer minpoll 4 maxpoll 5 iburst
# ptbtime2.ptb.de has been inserted as a fallback server, if local DCF77
# antenna or reciver has a malfunction, meanwhile all test-environments
# in the wild will synchronize its systems with this server
# --- Drift file Configuration ---
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /var/lib/ntpd/drift
# --- Log file Configuration ---
# The log configuration.
# Here is configured what you want to log or not
# The logfile has to be provided at startup as a parameter for ntpd
#
logconfig =clockevents +syncevents +sysevents +clockstatus +syncstatus +sysstatus +clockinfo +syncinfo +sysinfo +clockall +syncall +sysall
#
# Enabling and configuration for ntp statistics
#
enable stats
# statistics loopstats peerstats clockstats timingstats
# statsdir /var/lib/ntpd/stats/
statistics loopstats peerstats clockstats timingstats sysstats
statsdir /var/log/ntpd-stats/
filegen loopstats file loopstats type none enable
filegen peerstats file peerstats type none enable
filegen clockstats file clockstats type none enable
filegen timingstats file timingstats type none enable
filegen sysstats file sysstats type none enable
# End of configuration section
## EOF
A example configuration for a Stratum 2 server
#/bin/sh
#
#
# @(#)make 1.2 (maj) 2009/11/16
# Main configuration file for Stratum 2 ntp daemon
#
# Author: Jens Mahnke, ()
# Copyright (c) 2009 All rights reserved.
#
#
# --- GENERAL CONFIGURATION ---
#
# to detect falsespeaker and falseticker ntp server
server 192.168.0.10 prefer minpoll 4 maxpoll 5
server 192.168.0.11 prefer minpoll 4 maxpoll 5
server 192.168.0.12 prefer minpoll 4 maxpoll 5
server 192.168.0.13 prefer minpoll 4 maxpoll 5
#
# --- Fallback Configuration ---
#
# the local clock as Stratum 12 which is fall-back, if local Stratum 1 server offline ...
server 127.127.1.0
fudge 127.127.1.0 stratum 12
#
# --- Online Server as Backup Configuration ---
#
# ptbtime2.ptb.de has been inserted as a fallback server, if local Stratum 1 server
# has a malfunction, meanwhile all test-environments
# in the wild will synchronize its systems with this server
# server ptbtime2.ptb.de iburst minpoll 6 maxpoll 8
# server 192.53.103.108 prefer minpoll 4 maxpoll 5 iburst
#
# --- Drift file Configuration ---
#
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
driftfile /var/lib/ntpd/drift
#
# --- Log file Configuration ---
#
# Here is configured what you want to log or not
# The logfile has to be provided at startup as a parameter for ntpd
#
logconfig =clockevents +syncevents +sysevents +clockstatus +syncstatus +sysstatus +clockinfo +syncinfo +sysinfo +clockall +syncall +sysall
#
# Enabling and configuration for ntp statistics
# The 'filegen' directive changes the default settings for the
# statistics generation. Especially 'type none enable' ensures
# that only one flat text file for each statistics type will be
# generated as of in default for each day an ntpd internal 'log rotate'
# will genearte a statistic file named e.g. loopstats.20071030.
# gematik will enforce the standardized log-rotate mechanism to
# backup these statistic files on its own also for the possivility
# of compressing the statistic files with 'gzip -9' ;-)
enable stats
statistics loopstats peerstats clockstats timingstats sysstats
statsdir /var/log/ntpd-stats/
filegen loopstats file loopstats type none enable
filegen peerstats file peerstats type none enable
filegen clockstats file clockstats type none enable
filegen timingstats file timingstats type none enable
filegen sysstats file sysstats type none enable
# End of configuration section
## EOF
A example configuration for a Stratum 3 server
#/bin/sh
#
# @(#)make 1.2 (maj) 2009/11/20
# Main configuration file for Stratum 3 ntp daemon
#
# Author: Jens Mahnke, ()
# Copyright (c) 2009 All rights reserved.
#
#
# --- GENERAL CONFIGURATION ---
#
# to detect falsespeaker and falseticker ntp server
server 192.168.0.14 prefer minpoll 4 maxpoll 5
server 192.168.0.15 prefer minpoll 4 maxpoll 5
server 192.168.0.16 prefer minpoll 4 maxpoll 5
server 192.168.0.17 prefer minpoll 4 maxpoll 5
#
# --- Fallback Configuration ---
#
# the local clock as Stratum 14 which is fall-back, if local Stratum 1 server offline ...
server 127.127.1.0
fudge 127.127.1.0 stratum 14
#
# --- Online Server as Backup Configuration ---
#
# ptbtime2.ptb.de has been inserted as a fallback server, if local Stratum 2 server
# has a malfunction, meanwhile all test-environments
# in the wild will synchronize its systems with this server
# server ptbtime2.ptb.de iburst minpoll 6 maxpoll 8
# server 192.53.103.108 prefer minpoll 4 maxpoll 5 iburst
#
# --- Drift file Configuration ---
#
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
driftfile /var/lib/ntpd/drift
#
# --- Log file Configuration ---
#
# Here is configured what you want to log or not
# The logfile has to be provided at startup as a parameter for ntpd
#
logconfig =clockevents +syncevents +sysevents +clockstatus +syncstatus +sysstatus +clockinfo +syncinfo +sysinfo +clockall +syncall +sysall
#
# Enabling and configuration for ntp statistics
# The 'filegen' directive changes the default settings for the
# statistics generation. Especially 'type none enable' ensures
# that only one flat text file for each statistics type will be
# generated as of in default for each day an ntpd internal 'log rotate'
# will genearte a statistic file named e.g. loopstats.20071030.
# gematik will enforce the standardized log-rotate mechanism to
# backup these statistic files on its own also for the possivility
# of compressing the statistic files with 'gzip -9' ;-)
enable stats
statistics loopstats peerstats clockstats timingstats sysstats
statsdir /var/log/ntpd-stats/
filegen loopstats file loopstats type none enable
filegen peerstats file peerstats type none enable
filegen clockstats file clockstats type none enable
filegen timingstats file timingstats type none enable
filegen sysstats file sysstats type none enable
# End of configuration section
## EOF