xref: /freebsd/contrib/ntp/sntp/sntp.1sntpmdoc (revision 2b15cb3d0922bd70ea592f0da9b4a5b167f4d53f)
1*2b15cb3dSCy Schubert.Dd February 4 2015
2*2b15cb3dSCy Schubert.Dt SNTP 1sntpmdoc User Commands
3*2b15cb3dSCy Schubert.Os
4*2b15cb3dSCy Schubert.\"  EDIT THIS FILE WITH CAUTION  (sntp-opts.mdoc)
5*2b15cb3dSCy Schubert.\"
6*2b15cb3dSCy Schubert.\"  It has been AutoGen-ed  February  4, 2015 at 02:34:20 AM by AutoGen 5.18.5pre4
7*2b15cb3dSCy Schubert.\"  From the definitions    sntp-opts.def
8*2b15cb3dSCy Schubert.\"  and the template file   agmdoc-cmd.tpl
9*2b15cb3dSCy Schubert.Sh NAME
10*2b15cb3dSCy Schubert.Nm sntp
11*2b15cb3dSCy Schubert.Nd standard Simple Network Time Protocol client program
12*2b15cb3dSCy Schubert.Sh SYNOPSIS
13*2b15cb3dSCy Schubert.Nm
14*2b15cb3dSCy Schubert.\" Mixture of short (flag) options and long options
15*2b15cb3dSCy Schubert.Op Fl flags
16*2b15cb3dSCy Schubert.Op Fl flag Op Ar value
17*2b15cb3dSCy Schubert.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
18*2b15cb3dSCy Schubert[ hostname\-or\-IP ...]
19*2b15cb3dSCy Schubert.Pp
20*2b15cb3dSCy Schubert.Sh DESCRIPTION
21*2b15cb3dSCy Schubert.Nm
22*2b15cb3dSCy Schubertcan be used as an SNTP client to query a NTP or SNTP server and either display
23*2b15cb3dSCy Schubertthe time or set the local system's time (given suitable privilege).  It can be
24*2b15cb3dSCy Schubertrun as an interactive command or from a
25*2b15cb3dSCy Schubert.Ic cron
26*2b15cb3dSCy Schubertjob.
27*2b15cb3dSCy SchubertNTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
28*2b15cb3dSCy Schubertare defined and described by RFC 5905.
29*2b15cb3dSCy Schubert.Pp
30*2b15cb3dSCy SchubertThe default is to write the estimated correct local date and time (i.e. not
31*2b15cb3dSCy SchubertUTC) to the standard output in a format like:
32*2b15cb3dSCy Schubert.Ic "'1996\-10\-15 20:17:25.123 (+0800) +4.567 +/\- 0.089 [host] IP sN'"
33*2b15cb3dSCy Schubertwhere the
34*2b15cb3dSCy Schubert.Ic "'(+0800)'"
35*2b15cb3dSCy Schubertmeans that to get to UTC from the reported local time one must
36*2b15cb3dSCy Schubertadd 8 hours and 0 minutes,
37*2b15cb3dSCy Schubertthe
38*2b15cb3dSCy Schubert.Ic "'+4.567'"
39*2b15cb3dSCy Schubertindicates the local clock is 4.567 seconds behind the correct time
40*2b15cb3dSCy Schubert(so 4.567 seconds must be added to the local clock to get it to be correct).
41*2b15cb3dSCy SchubertNote that the number of decimals printed for this value will change
42*2b15cb3dSCy Schubertbased on the reported precision of the server.
43*2b15cb3dSCy Schubert.Ic "'+/\- 0.089'"
44*2b15cb3dSCy Schubertis the reported
45*2b15cb3dSCy Schubert.Em synchronization distance
46*2b15cb3dSCy Schubert(in seconds), which represents the maximum error due to all causes.
47*2b15cb3dSCy SchubertIf the server does not report valid data needed to calculate the
48*2b15cb3dSCy Schubertsynchronization distance, this will be reported as
49*2b15cb3dSCy Schubert.Ic "'+/\- ?'" .
50*2b15cb3dSCy SchubertIf the
51*2b15cb3dSCy Schubert.Em host
52*2b15cb3dSCy Schubertis different from the
53*2b15cb3dSCy Schubert.Em IP ,
54*2b15cb3dSCy Schubertboth will be displayed.
55*2b15cb3dSCy SchubertOtherwise, only the
56*2b15cb3dSCy Schubert.Em IP
57*2b15cb3dSCy Schubertis displayed.
58*2b15cb3dSCy SchubertFinally, the
59*2b15cb3dSCy Schubert.Em stratum
60*2b15cb3dSCy Schubertof the host is reported.
61*2b15cb3dSCy Schubert.Sh "OPTIONS"
62*2b15cb3dSCy Schubert.Bl -tag
63*2b15cb3dSCy Schubert.It  Fl 4 , Fl \-ipv4
64*2b15cb3dSCy SchubertForce IPv4 DNS name resolution.
65*2b15cb3dSCy SchubertThis option must not appear in combination with any of the following options:
66*2b15cb3dSCy Schubertipv6.
67*2b15cb3dSCy Schubert.sp
68*2b15cb3dSCy SchubertForce DNS resolution of the following host names on the command line
69*2b15cb3dSCy Schubertto the IPv4 namespace.
70*2b15cb3dSCy Schubert.It  Fl 6 , Fl \-ipv6
71*2b15cb3dSCy SchubertForce IPv6 DNS name resolution.
72*2b15cb3dSCy SchubertThis option must not appear in combination with any of the following options:
73*2b15cb3dSCy Schubertipv4.
74*2b15cb3dSCy Schubert.sp
75*2b15cb3dSCy SchubertForce DNS resolution of the following host names on the command line
76*2b15cb3dSCy Schubertto the IPv6 namespace.
77*2b15cb3dSCy Schubert.It  Fl a Ar auth\-keynumber , Fl \-authentication Ns = Ns Ar auth\-keynumber
78*2b15cb3dSCy SchubertEnable authentication with the key \fBauth\-keynumber\fP.
79*2b15cb3dSCy SchubertThis option takes an integer number as its argument.
80*2b15cb3dSCy Schubert.sp
81*2b15cb3dSCy SchubertEnable authentication using the key specified in this option's
82*2b15cb3dSCy Schubertargument.  The argument of this option is the \fBkeyid\fP, a
83*2b15cb3dSCy Schubertnumber specified in the \fBkeyfile\fP as this key's identifier.
84*2b15cb3dSCy SchubertSee the \fBkeyfile\fP option (\fB\-k\fP) for more details.
85*2b15cb3dSCy Schubert.It  Fl b Ar broadcast\-address , Fl \-broadcast Ns = Ns Ar broadcast\-address
86*2b15cb3dSCy SchubertListen to the address specified for broadcast time sync.
87*2b15cb3dSCy SchubertThis option may appear an unlimited number of times.
88*2b15cb3dSCy Schubert.sp
89*2b15cb3dSCy SchubertIf specified \fBsntp\fP will listen to the specified address
90*2b15cb3dSCy Schubertfor NTP broadcasts.  The default maximum wait time
91*2b15cb3dSCy Schubertcan (and probably should) be modified with \fB\-t\fP.
92*2b15cb3dSCy Schubert.It  Fl c Ar host\-name , Fl \-concurrent Ns = Ns Ar host\-name
93*2b15cb3dSCy SchubertConcurrently query all IPs returned for host\-name.
94*2b15cb3dSCy SchubertThis option may appear an unlimited number of times.
95*2b15cb3dSCy Schubert.sp
96*2b15cb3dSCy SchubertRequests from an NTP "client" to a "server" should never be sent
97*2b15cb3dSCy Schubertmore rapidly than one every 2 seconds.  By default, any IPs returned
98*2b15cb3dSCy Schubertas part of a DNS lookup are assumed to be for a single instance of
99*2b15cb3dSCy Schubert\fBntpd\fP, and therefore \fBsntp\fP will send queries to these IPs
100*2b15cb3dSCy Schubertone after another, with a 2\-second gap in between each query.
101*2b15cb3dSCy Schubert.sp
102*2b15cb3dSCy SchubertThe \fB\-c\fP or \fB\-\-concurrent\fP flag says that any IPs
103*2b15cb3dSCy Schubertreturned for the DNS lookup of the supplied host\-name are on
104*2b15cb3dSCy Schubertdifferent machines, so we can send concurrent queries.
105*2b15cb3dSCy Schubert.It  Fl d , Fl \-debug\-level
106*2b15cb3dSCy SchubertIncrease debug verbosity level.
107*2b15cb3dSCy SchubertThis option may appear an unlimited number of times.
108*2b15cb3dSCy Schubert.sp
109*2b15cb3dSCy Schubert.It  Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
110*2b15cb3dSCy SchubertSet the debug verbosity level.
111*2b15cb3dSCy SchubertThis option may appear an unlimited number of times.
112*2b15cb3dSCy SchubertThis option takes an integer number as its argument.
113*2b15cb3dSCy Schubert.sp
114*2b15cb3dSCy Schubert.It  Fl g Ar milliseconds , Fl \-gap Ns = Ns Ar milliseconds
115*2b15cb3dSCy SchubertThe gap (in milliseconds) between time requests.
116*2b15cb3dSCy SchubertThis option takes an integer number as its argument.
117*2b15cb3dSCy SchubertThe default
118*2b15cb3dSCy Schubert.Ar milliseconds
119*2b15cb3dSCy Schubertfor this option is:
120*2b15cb3dSCy Schubert.ti +4
121*2b15cb3dSCy Schubert 50
122*2b15cb3dSCy Schubert.sp
123*2b15cb3dSCy SchubertSince we're only going to use the first valid response we get and
124*2b15cb3dSCy Schubertthere is benefit to specifying a good number of servers to query,
125*2b15cb3dSCy Schubertseparate the queries we send out by the specified number of
126*2b15cb3dSCy Schubertmilliseconds.
127*2b15cb3dSCy Schubert.It  Fl K Ar file\-name , Fl \-kod Ns = Ns Ar file\-name
128*2b15cb3dSCy SchubertKoD history filename.
129*2b15cb3dSCy SchubertThe default
130*2b15cb3dSCy Schubert.Ar file\-name
131*2b15cb3dSCy Schubertfor this option is:
132*2b15cb3dSCy Schubert.ti +4
133*2b15cb3dSCy Schubert /var/db/ntp\-kod
134*2b15cb3dSCy Schubert.sp
135*2b15cb3dSCy SchubertSpecifies the filename to be used for the persistent history of KoD
136*2b15cb3dSCy Schubertresponses received from servers.  If the file does not exist, a
137*2b15cb3dSCy Schubertwarning message will be displayed.  The file will not be created.
138*2b15cb3dSCy Schubert.It  Fl k Ar file\-name , Fl \-keyfile Ns = Ns Ar file\-name
139*2b15cb3dSCy SchubertLook in this file for the key specified with \fB\-a\fP.
140*2b15cb3dSCy Schubert.sp
141*2b15cb3dSCy SchubertThis option specifies the keyfile.
142*2b15cb3dSCy Schubert\fBsntp\fP will search for the key specified with \fB\-a\fP
143*2b15cb3dSCy Schubert\fIkeyno\fP in this file.  See \fBntp.keys(5)\fP for more
144*2b15cb3dSCy Schubertinformation.
145*2b15cb3dSCy Schubert.It  Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name
146*2b15cb3dSCy SchubertLog to specified logfile.
147*2b15cb3dSCy Schubert.sp
148*2b15cb3dSCy SchubertThis option causes the client to write log messages to the specified
149*2b15cb3dSCy Schubert\fIlogfile\fP.
150*2b15cb3dSCy Schubert.It  Fl M Ar number , Fl \-steplimit Ns = Ns Ar number
151*2b15cb3dSCy SchubertAdjustments less than \fBsteplimit\fP msec will be slewed.
152*2b15cb3dSCy SchubertThis option takes an integer number as its argument.
153*2b15cb3dSCy SchubertThe value of
154*2b15cb3dSCy Schubert.Ar number
155*2b15cb3dSCy Schubertis constrained to being:
156*2b15cb3dSCy Schubert.in +4
157*2b15cb3dSCy Schubert.nf
158*2b15cb3dSCy Schubert.na
159*2b15cb3dSCy Schubertgreater than or equal to 0
160*2b15cb3dSCy Schubert.fi
161*2b15cb3dSCy Schubert.in -4
162*2b15cb3dSCy Schubert.sp
163*2b15cb3dSCy SchubertIf the time adjustment is less than \fIsteplimit\fP milliseconds,
164*2b15cb3dSCy Schubertslew the amount using \fBadjtime(2)\fP.  Otherwise, step the
165*2b15cb3dSCy Schubertcorrection using \fBsettimeofday(2)\fP.  The default value is 0,
166*2b15cb3dSCy Schubertwhich means all adjustments will be stepped.  This is a feature, as
167*2b15cb3dSCy Schubertdifferent situations demand different values.
168*2b15cb3dSCy Schubert.It  Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number
169*2b15cb3dSCy SchubertSend \fBint\fP as our NTP protocol version.
170*2b15cb3dSCy SchubertThis option takes an integer number as its argument.
171*2b15cb3dSCy SchubertThe value of
172*2b15cb3dSCy Schubert.Ar number
173*2b15cb3dSCy Schubertis constrained to being:
174*2b15cb3dSCy Schubert.in +4
175*2b15cb3dSCy Schubert.nf
176*2b15cb3dSCy Schubert.na
177*2b15cb3dSCy Schubertin the range  0 through 7
178*2b15cb3dSCy Schubert.fi
179*2b15cb3dSCy Schubert.in -4
180*2b15cb3dSCy SchubertThe default
181*2b15cb3dSCy Schubert.Ar number
182*2b15cb3dSCy Schubertfor this option is:
183*2b15cb3dSCy Schubert.ti +4
184*2b15cb3dSCy Schubert 4
185*2b15cb3dSCy Schubert.sp
186*2b15cb3dSCy SchubertWhen sending requests to a remote server, tell them we are running
187*2b15cb3dSCy SchubertNTP protocol version \fIntpversion\fP .
188*2b15cb3dSCy Schubert.It  Fl r , Fl \-usereservedport
189*2b15cb3dSCy SchubertUse the NTP Reserved Port (port 123).
190*2b15cb3dSCy Schubert.sp
191*2b15cb3dSCy SchubertUse port 123, which is reserved for NTP, for our network
192*2b15cb3dSCy Schubertcommunications.
193*2b15cb3dSCy Schubert.It  Fl S , Fl \-step
194*2b15cb3dSCy SchubertOK to 'step' the time with \fBsettimeofday(2)\fP.
195*2b15cb3dSCy Schubert.sp
196*2b15cb3dSCy Schubert.It  Fl s , Fl \-slew
197*2b15cb3dSCy SchubertOK to 'slew' the time with \fBadjtime(2)\fP.
198*2b15cb3dSCy Schubert.sp
199*2b15cb3dSCy Schubert.It  Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds
200*2b15cb3dSCy SchubertThe number of seconds to wait for responses.
201*2b15cb3dSCy SchubertThis option takes an integer number as its argument.
202*2b15cb3dSCy SchubertThe default
203*2b15cb3dSCy Schubert.Ar seconds
204*2b15cb3dSCy Schubertfor this option is:
205*2b15cb3dSCy Schubert.ti +4
206*2b15cb3dSCy Schubert 5
207*2b15cb3dSCy Schubert.sp
208*2b15cb3dSCy SchubertWhen waiting for a reply, \fBsntp\fP will wait the number
209*2b15cb3dSCy Schubertof seconds specified before giving up.  The default should be
210*2b15cb3dSCy Schubertmore than enough for a unicast response.  If \fBsntp\fP is
211*2b15cb3dSCy Schubertonly waiting for a broadcast response a longer timeout is
212*2b15cb3dSCy Schubertlikely needed.
213*2b15cb3dSCy Schubert.It  Fl \-wait , " Fl \-no\-wait"
214*2b15cb3dSCy SchubertWait for pending replies (if not setting the time).
215*2b15cb3dSCy SchubertThe \fIno\-wait\fP form will disable the option.
216*2b15cb3dSCy SchubertThis option is enabled by default.
217*2b15cb3dSCy Schubert.sp
218*2b15cb3dSCy SchubertIf we are not setting the time, wait for all pending responses.
219*2b15cb3dSCy Schubert.It Fl \&? , Fl \-help
220*2b15cb3dSCy SchubertDisplay usage information and exit.
221*2b15cb3dSCy Schubert.It Fl \&! , Fl \-more\-help
222*2b15cb3dSCy SchubertPass the extended usage information through a pager.
223*2b15cb3dSCy Schubert.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
224*2b15cb3dSCy SchubertSave the option state to \fIcfgfile\fP.  The default is the \fIlast\fP
225*2b15cb3dSCy Schubertconfiguration file listed in the \fBOPTION PRESETS\fP section, below.
226*2b15cb3dSCy SchubertThe command will exit after updating the config file.
227*2b15cb3dSCy Schubert.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
228*2b15cb3dSCy SchubertLoad options from \fIcfgfile\fP.
229*2b15cb3dSCy SchubertThe \fIno\-load\-opts\fP form will disable the loading
230*2b15cb3dSCy Schubertof earlier config/rc/ini files.  \fI\-\-no\-load\-opts\fP is handled early,
231*2b15cb3dSCy Schubertout of order.
232*2b15cb3dSCy Schubert.It Fl \-version Op Brq Ar v|c|n
233*2b15cb3dSCy SchubertOutput version of program and exit.  The default mode is `v', a simple
234*2b15cb3dSCy Schubertversion.  The `c' mode will print copyright information and `n' will
235*2b15cb3dSCy Schubertprint the full copyright notice.
236*2b15cb3dSCy Schubert.El
237*2b15cb3dSCy Schubert.Sh "OPTION PRESETS"
238*2b15cb3dSCy SchubertAny option that is not marked as \fInot presettable\fP may be preset
239*2b15cb3dSCy Schubertby loading values from configuration ("RC" or ".INI") file(s) and values from
240*2b15cb3dSCy Schubertenvironment variables named:
241*2b15cb3dSCy Schubert.nf
242*2b15cb3dSCy Schubert  \fBSNTP_<option\-name>\fP or \fBSNTP\fP
243*2b15cb3dSCy Schubert.fi
244*2b15cb3dSCy Schubert.ad
245*2b15cb3dSCy SchubertThe environmental presets take precedence (are processed later than)
246*2b15cb3dSCy Schubertthe configuration files.
247*2b15cb3dSCy SchubertThe \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
248*2b15cb3dSCy SchubertIf any of these are directories, then the file \fI.ntprc\fP
249*2b15cb3dSCy Schubertis searched for within those directories.
250*2b15cb3dSCy Schubert.Sh USAGE
251*2b15cb3dSCy Schubert.Bl -tag -width indent
252*2b15cb3dSCy Schubert.It Li "sntp ntpserver.somewhere"
253*2b15cb3dSCy Schubertis the simplest use of this program
254*2b15cb3dSCy Schubertand can be run as an unprivileged command
255*2b15cb3dSCy Schubertto check the current time and error in the local clock.
256*2b15cb3dSCy Schubert.It Li "sntp \-Ss \-M 128 ntpserver.somewhere"
257*2b15cb3dSCy SchubertWith suitable privilege,
258*2b15cb3dSCy Schubertrun as a command
259*2b15cb3dSCy Schubertor from a
260*2b15cb3dSCy Schubert.Xr cron 8
261*2b15cb3dSCy Schubertjob,
262*2b15cb3dSCy Schubert.Ic "sntp \-Ss \-M 128 ntpserver.somewhere"
263*2b15cb3dSCy Schubertwill request the time from the server,
264*2b15cb3dSCy Schubertand if that server reports that it is synchronized
265*2b15cb3dSCy Schubertthen if the offset adjustment is less than 128 milliseconds
266*2b15cb3dSCy Schubertthe correction will be slewed,
267*2b15cb3dSCy Schubertand if the correction is more than 128 milliseconds
268*2b15cb3dSCy Schubertthe correction  will be stepped.
269*2b15cb3dSCy Schubert.It Li "sntp \-S ntpserver.somewhere"
270*2b15cb3dSCy SchubertWith suitable privilege,
271*2b15cb3dSCy Schubertrun as a command
272*2b15cb3dSCy Schubertor from a
273*2b15cb3dSCy Schubert.Xr cron 8
274*2b15cb3dSCy Schubertjob,
275*2b15cb3dSCy Schubert.Ic "sntp \-S ntpserver.somewhere"
276*2b15cb3dSCy Schubertwill set (step) the local clock from a synchronized specified server,
277*2b15cb3dSCy Schubertlike the (deprecated)
278*2b15cb3dSCy Schubert.Xr ntpdate 1ntpdatemdoc ,
279*2b15cb3dSCy Schubertor
280*2b15cb3dSCy Schubert.Xr rdate 8
281*2b15cb3dSCy Schubertcommands.
282*2b15cb3dSCy Schubert.El
283*2b15cb3dSCy Schubert.Sh "ENVIRONMENT"
284*2b15cb3dSCy SchubertSee \fBOPTION PRESETS\fP for configuration environment variables.
285*2b15cb3dSCy Schubert.Sh "FILES"
286*2b15cb3dSCy SchubertSee \fBOPTION PRESETS\fP for configuration files.
287*2b15cb3dSCy Schubert.Sh "EXIT STATUS"
288*2b15cb3dSCy SchubertOne of the following exit values will be returned:
289*2b15cb3dSCy Schubert.Bl -tag
290*2b15cb3dSCy Schubert.It 0 " (EXIT_SUCCESS)"
291*2b15cb3dSCy SchubertSuccessful program execution.
292*2b15cb3dSCy Schubert.It 1 " (EXIT_FAILURE)"
293*2b15cb3dSCy SchubertThe operation failed or the command syntax was not valid.
294*2b15cb3dSCy Schubert.It 66 " (EX_NOINPUT)"
295*2b15cb3dSCy SchubertA specified configuration file could not be loaded.
296*2b15cb3dSCy Schubert.It 70 " (EX_SOFTWARE)"
297*2b15cb3dSCy Schubertlibopts had an internal operational error.  Please report
298*2b15cb3dSCy Schubertit to autogen\-users@lists.sourceforge.net.  Thank you.
299*2b15cb3dSCy Schubert.El
300*2b15cb3dSCy Schubert.Sh AUTHORS
301*2b15cb3dSCy Schubert.An "Johannes Maximilian Kuehn"
302*2b15cb3dSCy Schubert.An "Harlan Stenn"
303*2b15cb3dSCy Schubert.An "Dave Hart"
304*2b15cb3dSCy Schubert.Sh "COPYRIGHT"
305*2b15cb3dSCy SchubertCopyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
306*2b15cb3dSCy SchubertThis program is released under the terms of the NTP license, <http://ntp.org/license>.
307*2b15cb3dSCy Schubert.Sh "BUGS"
308*2b15cb3dSCy SchubertPlease send bug reports to: http://bugs.ntp.org, bugs@ntp.org
309*2b15cb3dSCy Schubert.Sh "NOTES"
310*2b15cb3dSCy SchubertThis manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP
311*2b15cb3dSCy Schubertoption definitions.
312