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