Blame timemaster.8

Packit 9c3e7e
.TH TIMEMASTER 8 "October 2014" "linuxptp"
Packit 9c3e7e
.SH NAME
Packit 9c3e7e
Packit 9c3e7e
timemaster - run NTP with PTP as reference clocks
Packit 9c3e7e
Packit 9c3e7e
.SH SYNOPSIS
Packit 9c3e7e
Packit 9c3e7e
.B timemaster
Packit 9c3e7e
[
Packit 9c3e7e
.B \-nmqv
Packit 9c3e7e
] [
Packit 9c3e7e
.BI \-l " print-level"
Packit 9c3e7e
]
Packit 9c3e7e
.BI \-f " file"
Packit 9c3e7e
Packit 9c3e7e
.SH DESCRIPTION
Packit 9c3e7e
\fBtimemaster\fR is a program that uses \fBptp4l\fR and \fBphc2sys\fR in
Packit 9c3e7e
combination with \fBchronyd\fR or \fBntpd\fR to synchronize the system clock to
Packit 9c3e7e
NTP and PTP time sources. The PTP time is provided by \fBphc2sys\fR and
Packit 9c3e7e
\fBptp4l\fR via SHM reference clocks to \fBchronyd\fR/\fBntpd\fR, which
Packit 9c3e7e
can compare all time sources and use the best sources to synchronize the system
Packit 9c3e7e
clock.
Packit 9c3e7e
Packit 9c3e7e
On start, \fBtimemaster\fR reads a configuration file that specifies the NTP
Packit 9c3e7e
and PTP time sources, checks which network interfaces have and share a PTP
Packit 9c3e7e
hardware clock (PHC), generates configuration files for \fBptp4l\fR and
Packit 9c3e7e
\fBchronyd\fR/\fBntpd\fR, and start the \fBptp4l\fR, \fBphc2sys\fR,
Packit 9c3e7e
\fBchronyd\fR/\fBntpd\fR processes as needed. Then, it waits for a signal to
Packit 9c3e7e
kill the processes, remove the generated configuration files and exit.
Packit 9c3e7e
Packit 9c3e7e
.SH OPTIONS
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-f " file"
Packit 9c3e7e
Specify the path to the \fBtimemaster\fR configuration file.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-n
Packit 9c3e7e
Don't start the programs, only print their configuration files and the commands
Packit 9c3e7e
that would be executed if this option wasn't specified.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-l " level"
Packit 9c3e7e
Set the maximum syslog level of messages which should be printed or sent to
Packit 9c3e7e
the system logger. The default value is 6 (LOG_INFO).
Packit 9c3e7e
.TP
Packit 9c3e7e
.B \-m
Packit 9c3e7e
Print messages to the standard output.
Packit 9c3e7e
.TP
Packit 9c3e7e
.B \-q
Packit 9c3e7e
Don't send messages to the system logger.
Packit 9c3e7e
.TP
Packit 9c3e7e
.B \-v
Packit 9c3e7e
Print the software version and exit.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-h
Packit 9c3e7e
Display a help message and exit.
Packit 9c3e7e
Packit 9c3e7e
.SH CONFIGURATION FILE
Packit 9c3e7e
Packit 9c3e7e
The configuration file is divided into sections. Each section starts with a
Packit 9c3e7e
line containing its name enclosed in brackets and it follows with settings.
Packit 9c3e7e
Each setting is placed on a separate line, it contains the name of the
Packit 9c3e7e
option and the value separated by whitespace characters. Empty lines and lines
Packit 9c3e7e
starting with # are ignored.
Packit 9c3e7e
Packit 9c3e7e
Sections that can used in the configuration file and options that can be set in
Packit 9c3e7e
them are described below.
Packit 9c3e7e
Packit 9c3e7e
.SS [timemaster]
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B ntp_program
Packit 9c3e7e
Select which NTP implementation should be used. Possible values are
Packit 9c3e7e
\fBchronyd\fR and \fBntpd\fR. The default value is \fBchronyd\fR. Limitations
Packit 9c3e7e
of the implementations relevant to the timemaster configuration are listed in
Packit 9c3e7e
\fBNOTES\fR.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B rundir
Packit 9c3e7e
Specify the directory where should be generated \fBchronyd\fR, \fBntpd\fR and
Packit 9c3e7e
\fBptp4l\fR configuration files and sockets. The directory will be created if
Packit 9c3e7e
it doesn't exist. The default value is \fB/var/run/timemaster\fR.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B first_shm_segment
Packit 9c3e7e
Specify the first number in a sequence of SHM segments that will be used by
Packit 9c3e7e
\fBptp4l\fR and \fBphc2sys\fR. The default value is 0. Increasing the number
Packit 9c3e7e
can be useful to avoid conflicts with time sources that are not started by
Packit 9c3e7e
\fBtimemaster\fR, e.g. \fBgpsd\fR using segments number 0 and 1.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B restart_processes
Packit 9c3e7e
Enable or disable restarting of processes started by \fBtimemaster\fR. If the
Packit 9c3e7e
option is set to a non-zero value, all processes except \fBchronyd\fR and
Packit 9c3e7e
\fBntpd\fR will be automatically restarted when terminated and \fBtimemaster\fR
Packit 9c3e7e
is running for at least one second (i.e. the process did not terminate due to a
Packit 9c3e7e
configuration error). If a process was terminated and is not started again,
Packit 9c3e7e
\fBtimemaster\fR will kill the other processes and exit with a non-zero status.
Packit 9c3e7e
The default value is 1 (enabled).
Packit 9c3e7e
Packit 9c3e7e
.SS [ntp_server address]
Packit 9c3e7e
Packit 9c3e7e
The \fBntp_server\fR section specifies an NTP server that should be used as a
Packit 9c3e7e
time source. The address of the server is included in the name of the section.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B minpoll
Packit 9c3e7e
.TQ
Packit 9c3e7e
.B maxpoll
Packit 9c3e7e
Specify the minimum and maximum NTP polling interval as powers of two in
Packit 9c3e7e
seconds. The default values are 6 (64 seconds) and 10 (1024 seconds)
Packit 9c3e7e
respectively. Shorter polling intervals usually improve the accuracy
Packit 9c3e7e
significantly, but they should be used only when allowed by the operators of
Packit 9c3e7e
the NTP service (public NTP servers generally don't allow too frequent
Packit 9c3e7e
queries). If the NTP server is located on the same LAN, polling intervals
Packit 9c3e7e
around 4 (16 seconds) might give best accuracy.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B iburst
Packit 9c3e7e
Enable or disable sending a burst of NTP packets on start to speed up the
Packit 9c3e7e
initial synchronization. Possible values are 1 and 0. The default value is 0
Packit 9c3e7e
(disabled).
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B ntp_options
Packit 9c3e7e
Specify extra options that should be added for this source to the \fBserver\fR
Packit 9c3e7e
directive in the configuration file of the selected NTP implementation. No
Packit 9c3e7e
extra options are added by default.
Packit 9c3e7e
Packit 9c3e7e
.SS [ptp_domain number]
Packit 9c3e7e
Packit 9c3e7e
The \fBptp_domain\fR section specifies a PTP domain that should be used as a
Packit 9c3e7e
time source. The PTP domain number is included in the name of the section. The
Packit 9c3e7e
\fBptp4l\fR instances are configured to run in the \fBslaveOnly\fR mode. In
Packit 9c3e7e
this section at least the \fBinterfaces\fR option needs to be set, other
Packit 9c3e7e
options are optional.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B interfaces
Packit 9c3e7e
Specify which network interfaces should be used for this PTP domain. A separate
Packit 9c3e7e
\fBptp4l\fR instance will be started for each group of interfaces sharing the
Packit 9c3e7e
same PHC and for each interface that supports only SW time stamping. HW time
Packit 9c3e7e
stamping is enabled automatically. If an interface with HW time stamping is
Packit 9c3e7e
specified also in other PTP domains, only the \fBptp4l\fR instance from the
Packit 9c3e7e
first PTP domain will be using HW time stamping.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B ntp_poll
Packit 9c3e7e
Specify the polling interval of the NTP SHM reference clock reading samples
Packit 9c3e7e
from \fBptp4l\fR or \fBphc2sys\fR. It's specified as a power of two in seconds.
Packit 9c3e7e
The default value is 2 (4 seconds).
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B phc2sys_poll
Packit 9c3e7e
Specify the polling interval used by \fBphc2sys\fR to read a PTP clock
Packit 9c3e7e
synchronized by \fBptp4l\fR and update the SHM sample for
Packit 9c3e7e
\fBchronyd\fR/\fBntpd\fR. It's specified as a power of two in seconds. The
Packit 9c3e7e
default value is 0 (1 second).
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B delay
Packit 9c3e7e
Specify the maximum assumed roundtrip delay to the primary source of the time
Packit 9c3e7e
in this PTP domain. This value is included in the distance used by
Packit 9c3e7e
\fBchronyd\fR in the source selection algorithm to detect falsetickers and
Packit 9c3e7e
assign weights for source combining. The default value is 1e\-4 (100
Packit 9c3e7e
microseconds). With \fBntpd\fR, the \fBtos mindist\fR command can be used to
Packit 9c3e7e
set a limit with similar purpose globally for all time sources.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B ntp_options
Packit 9c3e7e
Specify extra options that should be added for this source to the
Packit 9c3e7e
\fBrefclock\fR or \fBserver\fR directives in the configuration file of the
Packit 9c3e7e
selected NTP implementation. No extra options are added by default.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B ptp4l_option
Packit 9c3e7e
Specify an extra \fBptp4l\fR option specific to this PTP domain that should be
Packit 9c3e7e
added to the configuration files generated for \fBptp4l\fR. This option may be
Packit 9c3e7e
used multiple times in one \fBptp_domain\fR section.
Packit 9c3e7e
Packit 9c3e7e
.SS [chronyd]
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B path
Packit 9c3e7e
Specify the path to the \fBchronyd\fR binary. The default value is
Packit 9c3e7e
\fBchronyd\fR to search for the binary in \fBPATH\fR.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B options
Packit 9c3e7e
Specify extra options that should be added to the \fBchronyd\fR command line.
Packit 9c3e7e
No extra options are added by default.
Packit 9c3e7e
Packit 9c3e7e
.SS [chrony.conf]
Packit 9c3e7e
Packit 9c3e7e
Settings specified in this section are copied directly to the configuration
Packit 9c3e7e
file generated for \fBchronyd\fR. If this section is not present in the
Packit 9c3e7e
\fBtimemaster\fR configuration file, the following setting will be added:
Packit 9c3e7e
Packit 9c3e7e
.EX
Packit 9c3e7e
makestep 1 3
Packit 9c3e7e
.EE
Packit 9c3e7e
Packit 9c3e7e
This configures \fBchronyd\fR to step the system clock in the first three
Packit 9c3e7e
updates if the offset is larger than 1 second.
Packit 9c3e7e
Packit 9c3e7e
.SS [ntpd]
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B path
Packit 9c3e7e
Specify the path to the \fBntpd\fR binary. The default value is \fBntpd\fR to
Packit 9c3e7e
search for the binary in \fBPATH\fR.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B options
Packit 9c3e7e
Specify extra options that should be added to the \fBntpd\fR command line. No
Packit 9c3e7e
extra options are added by default.
Packit 9c3e7e
Packit 9c3e7e
.SS [ntp.conf]
Packit 9c3e7e
Packit 9c3e7e
Settings specified in this section are copied directly to the configuration
Packit 9c3e7e
file generated for \fBntpd\fR. If this section is not present in the
Packit 9c3e7e
\fBtimemaster\fR configuration file, the following settings will be added:
Packit 9c3e7e
Packit 9c3e7e
.EX
Packit 9c3e7e
restrict default nomodify notrap nopeer noquery
Packit 9c3e7e
restrict 127.0.0.1
Packit 9c3e7e
restrict ::1
Packit 9c3e7e
.EE
Packit 9c3e7e
Packit 9c3e7e
This configures \fBntpd\fR to use safe default restrictions.
Packit 9c3e7e
Packit 9c3e7e
.SS [phc2sys]
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B path
Packit 9c3e7e
Specify the path to the \fBphc2sys\fR binary. The default value is
Packit 9c3e7e
\fBphc2sys\fR to search for the binary in \fBPATH\fR.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B options
Packit 9c3e7e
Specify extra options that should be added to all \fBphc2sys\fR command lines.
Packit 9c3e7e
By default, \fB\-l 5\fR is added to the command lines.
Packit 9c3e7e
Packit 9c3e7e
.SS [ptp4l]
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B path
Packit 9c3e7e
Specify the path to the \fBptp4l\fR binary. The default value is \fBptp4l\fR to
Packit 9c3e7e
search for the binary in \fBPATH\fR.
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.B options
Packit 9c3e7e
Specify extra options that should be added to all \fBptp4l\fR command lines. By
Packit 9c3e7e
default, \fB\-l 5\fR is added to the command lines.
Packit 9c3e7e
Packit 9c3e7e
.SS [ptp4l.conf]
Packit 9c3e7e
Settings specified in this section are copied directly to the configuration
Packit 9c3e7e
files generated for all \fBptp4l\fR instances. There is no default content of
Packit 9c3e7e
this section.
Packit 9c3e7e
Packit 9c3e7e
.SH NOTES
Packit 9c3e7e
For best accuracy, \fBchronyd\fR is usually preferred over \fBntpd\fR, it also
Packit 9c3e7e
synchronizes the system clock faster. Both NTP implementations, however, have
Packit 9c3e7e
some limitations that need to be considered before choosing the one to be used
Packit 9c3e7e
in a given \fBtimemaster\fR configuration.
Packit 9c3e7e
Packit 9c3e7e
The \fBchronyd\fR limitations are:
Packit 9c3e7e
Packit 9c3e7e
.RS
Packit 9c3e7e
In version 1.31 and older, the maximum number of reference clocks used at the
Packit 9c3e7e
same time is 8. This limits the number of PHCs and interfaces using SW time
Packit 9c3e7e
stamping that can be used for PTP.
Packit 9c3e7e
Packit 9c3e7e
Using polling intervals (\fBminpoll\fR, \fBmaxpoll\fR, \fBntp_poll\fR options)
Packit 9c3e7e
shorter than 2 (4 seconds) is not recommended with versions before 1.30. With
Packit 9c3e7e
1.30 and later values of 0 or 1 can be used for NTP sources and negative values
Packit 9c3e7e
for PTP sources (\fBntp_poll\fR) to specify a subsecond interval.
Packit 9c3e7e
.RE
Packit 9c3e7e
Packit 9c3e7e
The \fBntpd\fR limitations are:
Packit 9c3e7e
Packit 9c3e7e
.RS
Packit 9c3e7e
In versions before 4.2.8p1, only the first two shared-memory segments created by
Packit 9c3e7e
the \fBntpd\fR SHM refclock driver have owner-only access. Other segments
Packit 9c3e7e
are created with world access, which allows any user on the system to write to
Packit 9c3e7e
the segments and disrupt or take control over the synchronization of the clock.
Packit 9c3e7e
In 4.2.8p1 the access was made configurable with the mode option, which is set
Packit 9c3e7e
by \fBtimemaster\fR for owner-ownly access.
Packit 9c3e7e
Packit 9c3e7e
The shortest polling interval for all sources is 3 (8 seconds).
Packit 9c3e7e
Packit 9c3e7e
Nanosecond resolution in the SHM refclock driver is supported in version
Packit 9c3e7e
4.2.7p303 and later, older versions have only microsecond resolution.
Packit 9c3e7e
.RE
Packit 9c3e7e
Packit 9c3e7e
.SH EXAMPLES
Packit 9c3e7e
Packit 9c3e7e
A minimal configuration file using one NTP source and two PTP sources would be:
Packit 9c3e7e
Packit 9c3e7e
.EX
Packit 9c3e7e
[ntp_server 10.1.1.1]
Packit 9c3e7e
Packit 9c3e7e
[ptp_domain 0]
Packit 9c3e7e
interfaces eth0
Packit 9c3e7e
Packit 9c3e7e
[ptp_domain 1]
Packit 9c3e7e
interfaces eth1
Packit 9c3e7e
.EE
Packit 9c3e7e
Packit 9c3e7e
A more complex example using all \fBtimemaster\fR options would be:
Packit 9c3e7e
Packit 9c3e7e
.EX
Packit 9c3e7e
[ntp_server 10.1.1.1]
Packit 9c3e7e
minpoll 3
Packit 9c3e7e
maxpoll 4
Packit 9c3e7e
iburst 1
Packit 9c3e7e
ntp_options key 12
Packit 9c3e7e
Packit 9c3e7e
[ptp_domain 0]
Packit 9c3e7e
interfaces eth0 eth1
Packit 9c3e7e
ntp_poll 0
Packit 9c3e7e
phc2sys_poll \-2
Packit 9c3e7e
delay 10e\-6
Packit 9c3e7e
ntp_options prefer
Packit 9c3e7e
ptp4l_option clock_servo linreg
Packit 9c3e7e
ptp4l_option delay_mechanism P2P
Packit 9c3e7e
Packit 9c3e7e
[timemaster]
Packit 9c3e7e
ntp_program chronyd
Packit 9c3e7e
rundir /var/run/timemaster
Packit 9c3e7e
first_shm_segment 1
Packit 9c3e7e
restart_processes 0
Packit 9c3e7e
Packit 9c3e7e
[chronyd]
Packit 9c3e7e
path /usr/sbin/chronyd
Packit 9c3e7e
options
Packit 9c3e7e
Packit 9c3e7e
[chrony.conf]
Packit 9c3e7e
makestep 1 3
Packit 9c3e7e
logchange 0.5
Packit 9c3e7e
rtcsync
Packit 9c3e7e
driftfile /var/lib/chrony/drift
Packit 9c3e7e
Packit 9c3e7e
[ntpd]
Packit 9c3e7e
path /usr/sbin/ntpd
Packit 9c3e7e
options \-u ntp:ntp
Packit 9c3e7e
Packit 9c3e7e
[ntp.conf]
Packit 9c3e7e
restrict default nomodify notrap nopeer noquery
Packit 9c3e7e
restrict 127.0.0.1
Packit 9c3e7e
restrict ::1
Packit 9c3e7e
driftfile /var/lib/ntp/drift
Packit 9c3e7e
Packit 9c3e7e
[phc2sys]
Packit 9c3e7e
path /usr/sbin/phc2sys
Packit 9c3e7e
options \-l 5
Packit 9c3e7e
Packit 9c3e7e
[ptp4l]
Packit 9c3e7e
path /usr/sbin/ptp4l
Packit 9c3e7e
options
Packit 9c3e7e
Packit 9c3e7e
[ptp4l.conf]
Packit 9c3e7e
logging_level 5
Packit 9c3e7e
.EE
Packit 9c3e7e
Packit 9c3e7e
.SH SEE ALSO
Packit 9c3e7e
Packit 9c3e7e
.BR chronyd (8),
Packit 9c3e7e
.BR ntpd (8),
Packit 9c3e7e
.BR phc2sys (8),
Packit 9c3e7e
.BR ptp4l (8)