1310419Sdelphij.Dd November 21 2016 2290001Sglebius.Dt SNTP 8 User Commands 3290001Sglebius.Os 4290001Sglebius.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) 5290001Sglebius.\" 6290001Sglebius.\" $FreeBSD: releng/9.3/usr.sbin/ntp/doc/sntp.8 310419 2016-12-22 16:19:05Z delphij $ 7290001Sglebius.\" 8310419Sdelphij.\" It has been AutoGen-ed November 21, 2016 at 07:58:32 AM by AutoGen 5.18.5 9290001Sglebius.\" From the definitions sntp-opts.def 10290001Sglebius.\" and the template file agmdoc-cmd.tpl 11290001Sglebius.Sh NAME 12290001Sglebius.Nm sntp 13290001Sglebius.Nd standard Simple Network Time Protocol client program 14290001Sglebius.Sh SYNOPSIS 15290001Sglebius.Nm 16290001Sglebius.\" Mixture of short (flag) options and long options 17290001Sglebius.Op Fl flags 18290001Sglebius.Op Fl flag Op Ar value 19290001Sglebius.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc 20290001Sglebius[ hostname\-or\-IP ...] 21290001Sglebius.Pp 22290001Sglebius.Sh DESCRIPTION 23290001Sglebius.Nm 24290001Sglebiuscan be used as an SNTP client to query a NTP or SNTP server and either display 25290001Sglebiusthe time or set the local system's time (given suitable privilege). It can be 26290001Sglebiusrun as an interactive command or from a 27290001Sglebius.Ic cron 28290001Sglebiusjob. 29290001SglebiusNTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) 30290001Sglebiusare defined and described by RFC 5905. 31290001Sglebius.Pp 32290001SglebiusThe default is to write the estimated correct local date and time (i.e. not 33290001SglebiusUTC) to the standard output in a format like: 34290001Sglebius.Ic "'1996\-10\-15 20:17:25.123 (+0800) +4.567 +/\- 0.089 [host] IP sN'" 35290001Sglebiuswhere the 36290001Sglebius.Ic "'(+0800)'" 37290001Sglebiusmeans that to get to UTC from the reported local time one must 38290001Sglebiusadd 8 hours and 0 minutes, 39290001Sglebiusthe 40290001Sglebius.Ic "'+4.567'" 41290001Sglebiusindicates the local clock is 4.567 seconds behind the correct time 42290001Sglebius(so 4.567 seconds must be added to the local clock to get it to be correct). 43290001SglebiusNote that the number of decimals printed for this value will change 44290001Sglebiusbased on the reported precision of the server. 45290001Sglebius.Ic "'+/\- 0.089'" 46290001Sglebiusis the reported 47290001Sglebius.Em synchronization distance 48290001Sglebius(in seconds), which represents the maximum error due to all causes. 49290001SglebiusIf the server does not report valid data needed to calculate the 50290001Sglebiussynchronization distance, this will be reported as 51290001Sglebius.Ic "'+/\- ?'" . 52290001SglebiusIf the 53290001Sglebius.Em host 54290001Sglebiusis different from the 55290001Sglebius.Em IP , 56290001Sglebiusboth will be displayed. 57290001SglebiusOtherwise, only the 58290001Sglebius.Em IP 59290001Sglebiusis displayed. 60290001SglebiusFinally, the 61290001Sglebius.Em stratum 62290001Sglebiusof the host is reported 63290001Sglebiusand the leap indicator is decoded and displayed. 64290001Sglebius.Sh "OPTIONS" 65290001Sglebius.Bl -tag 66290001Sglebius.It Fl 4 , Fl \-ipv4 67290001SglebiusForce IPv4 DNS name resolution. 68290001SglebiusThis option must not appear in combination with any of the following options: 69290001Sglebiusipv6. 70290001Sglebius.sp 71290001SglebiusForce DNS resolution of the following host names on the command line 72290001Sglebiusto the IPv4 namespace. 73290001Sglebius.It Fl 6 , Fl \-ipv6 74290001SglebiusForce IPv6 DNS name resolution. 75290001SglebiusThis option must not appear in combination with any of the following options: 76290001Sglebiusipv4. 77290001Sglebius.sp 78290001SglebiusForce DNS resolution of the following host names on the command line 79290001Sglebiusto the IPv6 namespace. 80290001Sglebius.It Fl a Ar auth\-keynumber , Fl \-authentication Ns = Ns Ar auth\-keynumber 81290001SglebiusEnable authentication with the key \fBauth\-keynumber\fP. 82290001SglebiusThis option takes an integer number as its argument. 83290001Sglebius.sp 84290001SglebiusEnable authentication using the key specified in this option's 85290001Sglebiusargument. The argument of this option is the \fBkeyid\fP, a 86290001Sglebiusnumber specified in the \fBkeyfile\fP as this key's identifier. 87290001SglebiusSee the \fBkeyfile\fP option (\fB\-k\fP) for more details. 88290001Sglebius.It Fl b Ar broadcast\-address , Fl \-broadcast Ns = Ns Ar broadcast\-address 89290001SglebiusListen to the address specified for broadcast time sync. 90290001SglebiusThis option may appear an unlimited number of times. 91290001Sglebius.sp 92290001SglebiusIf specified \fBsntp\fP will listen to the specified address 93290001Sglebiusfor NTP broadcasts. The default maximum wait time 94290001Sglebiuscan (and probably should) be modified with \fB\-t\fP. 95290001Sglebius.It Fl c Ar host\-name , Fl \-concurrent Ns = Ns Ar host\-name 96290001SglebiusConcurrently query all IPs returned for host\-name. 97290001SglebiusThis option may appear an unlimited number of times. 98290001Sglebius.sp 99290001SglebiusRequests from an NTP "client" to a "server" should never be sent 100290001Sglebiusmore rapidly than one every 2 seconds. By default, any IPs returned 101290001Sglebiusas part of a DNS lookup are assumed to be for a single instance of 102290001Sglebius\fBntpd\fP, and therefore \fBsntp\fP will send queries to these IPs 103290001Sglebiusone after another, with a 2\-second gap in between each query. 104290001Sglebius.sp 105290001SglebiusThe \fB\-c\fP or \fB\-\-concurrent\fP flag says that any IPs 106290001Sglebiusreturned for the DNS lookup of the supplied host\-name are on 107290001Sglebiusdifferent machines, so we can send concurrent queries. 108290001Sglebius.It Fl d , Fl \-debug\-level 109290001SglebiusIncrease debug verbosity level. 110290001SglebiusThis option may appear an unlimited number of times. 111290001Sglebius.sp 112290001Sglebius.It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number 113290001SglebiusSet the debug verbosity level. 114290001SglebiusThis option may appear an unlimited number of times. 115290001SglebiusThis option takes an integer number as its argument. 116290001Sglebius.sp 117290001Sglebius.It Fl g Ar milliseconds , Fl \-gap Ns = Ns Ar milliseconds 118290001SglebiusThe gap (in milliseconds) between time requests. 119290001SglebiusThis option takes an integer number as its argument. 120290001SglebiusThe default 121290001Sglebius.Ar milliseconds 122290001Sglebiusfor this option is: 123290001Sglebius.ti +4 124290001Sglebius 50 125290001Sglebius.sp 126290001SglebiusSince we're only going to use the first valid response we get and 127290001Sglebiusthere is benefit to specifying a good number of servers to query, 128290001Sglebiusseparate the queries we send out by the specified number of 129290001Sglebiusmilliseconds. 130290001Sglebius.It Fl K Ar file\-name , Fl \-kod Ns = Ns Ar file\-name 131290001SglebiusKoD history filename. 132290001SglebiusThe default 133290001Sglebius.Ar file\-name 134290001Sglebiusfor this option is: 135290001Sglebius.ti +4 136290001Sglebius /var/db/ntp\-kod 137290001Sglebius.sp 138290001SglebiusSpecifies the filename to be used for the persistent history of KoD 139290001Sglebiusresponses received from servers. If the file does not exist, a 140290001Sglebiuswarning message will be displayed. The file will not be created. 141290001Sglebius.It Fl k Ar file\-name , Fl \-keyfile Ns = Ns Ar file\-name 142290001SglebiusLook in this file for the key specified with \fB\-a\fP. 143290001Sglebius.sp 144290001SglebiusThis option specifies the keyfile. 145290001Sglebius\fBsntp\fP will search for the key specified with \fB\-a\fP 146290001Sglebius\fIkeyno\fP in this file. See \fBntp.keys(5)\fP for more 147290001Sglebiusinformation. 148290001Sglebius.It Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name 149290001SglebiusLog to specified logfile. 150290001Sglebius.sp 151290001SglebiusThis option causes the client to write log messages to the specified 152290001Sglebius\fIlogfile\fP. 153290001Sglebius.It Fl M Ar number , Fl \-steplimit Ns = Ns Ar number 154290001SglebiusAdjustments less than \fBsteplimit\fP msec will be slewed. 155290001SglebiusThis option takes an integer number as its argument. 156290001SglebiusThe value of 157290001Sglebius.Ar number 158290001Sglebiusis constrained to being: 159290001Sglebius.in +4 160290001Sglebius.nf 161290001Sglebius.na 162290001Sglebiusgreater than or equal to 0 163290001Sglebius.fi 164290001Sglebius.in -4 165290001Sglebius.sp 166290001SglebiusIf the time adjustment is less than \fIsteplimit\fP milliseconds, 167290001Sglebiusslew the amount using \fBadjtime(2)\fP. Otherwise, step the 168290001Sglebiuscorrection using \fBsettimeofday(2)\fP. The default value is 0, 169290001Sglebiuswhich means all adjustments will be stepped. This is a feature, as 170290001Sglebiusdifferent situations demand different values. 171290001Sglebius.It Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number 172290001SglebiusSend \fBint\fP as our NTP protocol version. 173290001SglebiusThis option takes an integer number as its argument. 174290001SglebiusThe value of 175290001Sglebius.Ar number 176290001Sglebiusis constrained to being: 177290001Sglebius.in +4 178290001Sglebius.nf 179290001Sglebius.na 180290001Sglebiusin the range 0 through 7 181290001Sglebius.fi 182290001Sglebius.in -4 183290001SglebiusThe default 184290001Sglebius.Ar number 185290001Sglebiusfor this option is: 186290001Sglebius.ti +4 187290001Sglebius 4 188290001Sglebius.sp 189290001SglebiusWhen sending requests to a remote server, tell them we are running 190290001SglebiusNTP protocol version \fIntpversion\fP . 191290001Sglebius.It Fl r , Fl \-usereservedport 192290001SglebiusUse the NTP Reserved Port (port 123). 193290001Sglebius.sp 194290001SglebiusUse port 123, which is reserved for NTP, for our network 195290001Sglebiuscommunications. 196290001Sglebius.It Fl S , Fl \-step 197290001SglebiusOK to 'step' the time with \fBsettimeofday(2)\fP. 198290001Sglebius.sp 199290001Sglebius.It Fl s , Fl \-slew 200290001SglebiusOK to 'slew' the time with \fBadjtime(2)\fP. 201290001Sglebius.sp 202290001Sglebius.It Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds 203290001SglebiusThe number of seconds to wait for responses. 204290001SglebiusThis option takes an integer number as its argument. 205290001SglebiusThe default 206290001Sglebius.Ar seconds 207290001Sglebiusfor this option is: 208290001Sglebius.ti +4 209290001Sglebius 5 210290001Sglebius.sp 211290001SglebiusWhen waiting for a reply, \fBsntp\fP will wait the number 212290001Sglebiusof seconds specified before giving up. The default should be 213290001Sglebiusmore than enough for a unicast response. If \fBsntp\fP is 214290001Sglebiusonly waiting for a broadcast response a longer timeout is 215290001Sglebiuslikely needed. 216310419Sdelphij.It Fl \-wait , Fl \-no\-wait 217290001SglebiusWait for pending replies (if not setting the time). 218290001SglebiusThe \fIno\-wait\fP form will disable the option. 219290001SglebiusThis option is enabled by default. 220290001Sglebius.sp 221290001SglebiusIf we are not setting the time, wait for all pending responses. 222290001Sglebius.It Fl \&? , Fl \-help 223290001SglebiusDisplay usage information and exit. 224290001Sglebius.It Fl \&! , Fl \-more\-help 225290001SglebiusPass the extended usage information through a pager. 226290001Sglebius.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc 227290001SglebiusSave the option state to \fIcfgfile\fP. The default is the \fIlast\fP 228290001Sglebiusconfiguration file listed in the \fBOPTION PRESETS\fP section, below. 229290001SglebiusThe command will exit after updating the config file. 230290001Sglebius.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts 231290001SglebiusLoad options from \fIcfgfile\fP. 232290001SglebiusThe \fIno\-load\-opts\fP form will disable the loading 233290001Sglebiusof earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early, 234290001Sglebiusout of order. 235290001Sglebius.It Fl \-version Op Brq Ar v|c|n 236290001SglebiusOutput version of program and exit. The default mode is `v', a simple 237290001Sglebiusversion. The `c' mode will print copyright information and `n' will 238290001Sglebiusprint the full copyright notice. 239290001Sglebius.El 240290001Sglebius.Sh "OPTION PRESETS" 241290001SglebiusAny option that is not marked as \fInot presettable\fP may be preset 242290001Sglebiusby loading values from configuration ("RC" or ".INI") file(s) and values from 243290001Sglebiusenvironment variables named: 244290001Sglebius.nf 245290001Sglebius \fBSNTP_<option\-name>\fP or \fBSNTP\fP 246290001Sglebius.fi 247290001Sglebius.ad 248290001SglebiusThe environmental presets take precedence (are processed later than) 249290001Sglebiusthe configuration files. 250290001SglebiusThe \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". 251290001SglebiusIf any of these are directories, then the file \fI.ntprc\fP 252290001Sglebiusis searched for within those directories. 253290001Sglebius.Sh USAGE 254290001Sglebius.Bl -tag -width indent 255290001Sglebius.It Li "sntp ntpserver.somewhere" 256290001Sglebiusis the simplest use of this program 257290001Sglebiusand can be run as an unprivileged command 258290001Sglebiusto check the current time and error in the local clock. 259290001Sglebius.It Li "sntp \-Ss \-M 128 ntpserver.somewhere" 260290001SglebiusWith suitable privilege, 261290001Sglebiusrun as a command 262290001Sglebiusor from a 263290001Sglebius.Xr cron 8 264290001Sglebiusjob, 265290001Sglebius.Ic "sntp \-Ss \-M 128 ntpserver.somewhere" 266290001Sglebiuswill request the time from the server, 267290001Sglebiusand if that server reports that it is synchronized 268290001Sglebiusthen if the offset adjustment is less than 128 milliseconds 269290001Sglebiusthe correction will be slewed, 270290001Sglebiusand if the correction is more than 128 milliseconds 271290001Sglebiusthe correction will be stepped. 272290001Sglebius.It Li "sntp \-S ntpserver.somewhere" 273290001SglebiusWith suitable privilege, 274290001Sglebiusrun as a command 275290001Sglebiusor from a 276290001Sglebius.Xr cron 8 277290001Sglebiusjob, 278290001Sglebius.Ic "sntp \-S ntpserver.somewhere" 279290001Sglebiuswill set (step) the local clock from a synchronized specified server, 280290001Sglebiuslike the (deprecated) 281290001Sglebius.Xr ntpdate 8 , 282290001Sglebiusor 283290001Sglebius.Xr rdate 8 284290001Sglebiuscommands. 285290001Sglebius.El 286290001Sglebius.Sh "ENVIRONMENT" 287290001SglebiusSee \fBOPTION PRESETS\fP for configuration environment variables. 288290001Sglebius.Sh "FILES" 289290001SglebiusSee \fBOPTION PRESETS\fP for configuration files. 290290001Sglebius.Sh "EXIT STATUS" 291290001SglebiusOne of the following exit values will be returned: 292290001Sglebius.Bl -tag 293290001Sglebius.It 0 " (EXIT_SUCCESS)" 294290001SglebiusSuccessful program execution. 295290001Sglebius.It 1 " (EXIT_FAILURE)" 296290001SglebiusThe operation failed or the command syntax was not valid. 297290001Sglebius.It 66 " (EX_NOINPUT)" 298290001SglebiusA specified configuration file could not be loaded. 299290001Sglebius.It 70 " (EX_SOFTWARE)" 300290001Sglebiuslibopts had an internal operational error. Please report 301290001Sglebiusit to autogen\-users@lists.sourceforge.net. Thank you. 302290001Sglebius.El 303290001Sglebius.Sh AUTHORS 304290001Sglebius.An "Johannes Maximilian Kuehn" 305290001Sglebius.An "Harlan Stenn" 306290001Sglebius.An "Dave Hart" 307290001Sglebius.Sh "COPYRIGHT" 308294905SdelphijCopyright (C) 1992\-2016 The University of Delaware and Network Time Foundation all rights reserved. 309290001SglebiusThis program is released under the terms of the NTP license, <http://ntp.org/license>. 310290001Sglebius.Sh "BUGS" 311290001SglebiusPlease send bug reports to: http://bugs.ntp.org, bugs@ntp.org 312290001Sglebius.Sh "NOTES" 313290001SglebiusThis manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP 314290001Sglebiusoption definitions. 315