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