Blame timemaster.8

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