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