timed.8   [plain text]


.\" Copyright (c) 1980, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)timed.8	8.1 (Berkeley) 6/6/93
.\" $FreeBSD: src/usr.sbin/timed/timed/timed.8,v 1.18 2008/02/11 08:12:58 remko Exp $
.\"
.Dd February 11, 2008
.Dt TIMED 8
.Os
.Sh NAME
.Nm timed
.Nd time server daemon
.Sh SYNOPSIS
.Nm
.Op Fl dtM
.Op Fl i Ar network | Fl n Ar network
.Op Fl F Ar host ...
.Sh DESCRIPTION
The
.Nm
utility is a time server daemon
.\"which is normally invoked at boot time from the
.\".Xr rc.network 8
.\"file.
which may be invoked at boot time via
.Xr launchd 8 .
(See
.Xr launchd.plist 5
for more information about configuring daemons to run at boot.)
It synchronizes the host's time with the time of other
machines, which are also running
.Nm ,
in a local area network.
These time servers will slow down the clocks of some machines
and speed up the clocks of others to bring them to the average network time.
The average network time is computed from measurements of clock differences
using the
.Tn ICMP
timestamp request message.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl d
Enable debugging mode;
do not detach from the terminal.
.It Fl i Ar network
Add
.Ar network
to the list of networks to ignore.
All other networks
to which the machine is directly connected
are used by
.Nm .
This option may be specified multiple times
to add more than one network to the list.
.It Fl F Ar host ...
.in +2
.ti -2
-
Create a list of trusted hosts.
.ti -2
-
Can take one or more parameters.
.ti -2
-
.Nm
will only accept trusted hosts as masters.
If it finds an untrusted host claiming to be master,
.Nm
will suppress incoming messages from that host
and call for a new election.
.ti -2
-
Use real host names (resolvable by RDNS) not aliases (eg in 
.Xr named 8
parlance: use A names, not C names).
.ti -2
-
Use full names eg time1.domain.com not time1.
.ti -2
-
.Fl F
automatically includes the functionality of 
.Fl M
( so
.Fl M
does not need to asserted).
.ti -2
-
If 
.Fl F
is not specified,
all hosts on connected networks are treated as trustworthy.
.in -2
.It Fl M
Allow this host to become a
.Nm
master if necessary.
.It Fl n Ar network
Add
.Ar network
to the list of allowed networks.
All other networks
to which the machine is directly connected
are ignored by
.Nm .
This option may be specified multiple times
to add more than one network to the list.
.It Fl t
Enable tracing of received messages
and log to the file
.Pa /var/log/timed.log .
Tracing can be turned on or off while
.Nm
is running with the
.Xr timedc 8
utility.
.El
.Pp
The
.Fl n
and
.Fl i
flags are mutually exclusive
and require as arguments real networks to which
the host is connected
(see
.Xr networks 5 ) .
If neither flag is specified,
.Nm
will listen on all connected networks.
.Pp
A
.Nm
running without the
.Fl M
nor
.Fl F
flags will always remain a slave.
If the
.Fl F
flag is not used,
.Nm
will treat all machines as trustworthy.
.Pp
The
.Nm
utility is based on a master-slave
scheme.
When
.Nm
is started on a machine, it asks the master for the network time
and sets the host's clock to that time.
After that, it accepts synchronization messages periodically sent by
the master and calls
.Xr adjtime 2
to perform the needed corrections on the host's clock.
.Pp
It also communicates with
.Xr date 1
in order to set the date globally,
and with
.Xr timedc 8 ,
a
.Nm
control utility.
If the machine running the master becomes unreachable,
the slaves will elect a new master
from among those slaves
which are running with at least one of the
.Fl M
and
.Fl F
flags.
.Pp
At startup
.Nm
normally checks for a master time server on each network to which
it is connected, except as modified by the
.Fl n
and
.Fl i
options described above.
It will request synchronization service from the first master server
located.
If permitted by the
.Fl M
or
.Fl F
flags, it will provide synchronization service on any attached networks
on which no trusted master server was detected.
Such a server propagates the time computed by the top-level master.
The
.Nm
utility will periodically check for the presence of a master
on those networks for which it is operating as a slave.
If it finds that there are no trusted masters on a network,
it will begin the election process on that network.
.Pp
One way to synchronize a group of machines is to use
.Xr ntpd 8
to
synchronize the clock of one machine to a distant standard or a radio
receiver and
.Fl F Ar hostname
to tell its
.Nm
to trust only itself.
.Pp
Messages printed by the kernel on the system console occur with
interrupts disabled.
This means that the clock stops while they are printing.
A machine with many disk or network hardware problems and consequent
messages cannot keep good time by itself.
Each message typically causes
the clock to lose a dozen milliseconds.
A time daemon can correct the result.
.Pp
Messages in the system log about machines that failed to respond
usually indicate machines that crashed or were turned off.
Complaints about machines that failed to respond to initial time
settings are often associated with
.Dq multi-homed
machines that looked for time masters on more than one network and eventually
chose to become a slave on the other network.
.Sh WARNINGS
Temporal chaos will result if two or more time daemons attempt
to adjust the same clock.
If both
.Nm
and another time daemon are run on the same machine,
ensure that the
.Fl F
flag is used, so that
.Nm
never attempts to adjust the local clock.
.Pp
The protocol is based on
.Tn UDP/IP
broadcasts.
All machines within the range of a broadcast that are using the
.Tn TSP
protocol must cooperate.
There cannot be more than a single administrative domain using the
.Fl F
flag among all machines reached by a broadcast packet.
Failure to follow this rule is usually indicated by complaints concerning
.Dq untrusted
machines in the system log.
.Sh FILES
.Bl -tag -width /var/log/timed.masterlog -compact
.It Pa /var/log/timed.log
tracing file for
.Nm
.It Pa /var/log/timed.masterlog
log file for master
.Nm
.El
.Sh SEE ALSO
.Xr date 1 ,
.Xr adjtime 2 ,
.Xr gettimeofday 2 ,
.Xr icmp 4 ,
.Xr networks 5 ,
.Xr ntpd 8 ,
.Xr timedc 8
.Rs
.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD"
.%A R. Gusella
.%A S. Zatti
.Re
.Sh HISTORY
The
.Nm
utility appeared in
.Bx 4.3 .