xref: /freebsd/contrib/ntp/sntp/sntp.1sntpmdoc (revision a25439b68651d176ae05867f5090d45fd85e9f24)
1*a25439b6SCy Schubert.Dd April 7 2015
22b15cb3dSCy Schubert.Dt SNTP 1sntpmdoc User Commands
32b15cb3dSCy Schubert.Os
42b15cb3dSCy Schubert.\"  EDIT THIS FILE WITH CAUTION  (sntp-opts.mdoc)
52b15cb3dSCy Schubert.\"
6*a25439b6SCy Schubert.\"  It has been AutoGen-ed  April  7, 2015 at 04:18:06 AM by AutoGen 5.18.5pre4
72b15cb3dSCy Schubert.\"  From the definitions    sntp-opts.def
82b15cb3dSCy Schubert.\"  and the template file   agmdoc-cmd.tpl
92b15cb3dSCy Schubert.Sh NAME
102b15cb3dSCy Schubert.Nm sntp
112b15cb3dSCy Schubert.Nd standard Simple Network Time Protocol client program
122b15cb3dSCy Schubert.Sh SYNOPSIS
132b15cb3dSCy Schubert.Nm
142b15cb3dSCy Schubert.\" Mixture of short (flag) options and long options
152b15cb3dSCy Schubert.Op Fl flags
162b15cb3dSCy Schubert.Op Fl flag Op Ar value
172b15cb3dSCy Schubert.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
182b15cb3dSCy Schubert[ hostname\-or\-IP ...]
192b15cb3dSCy Schubert.Pp
202b15cb3dSCy Schubert.Sh DESCRIPTION
212b15cb3dSCy Schubert.Nm
222b15cb3dSCy Schubertcan be used as an SNTP client to query a NTP or SNTP server and either display
232b15cb3dSCy Schubertthe time or set the local system's time (given suitable privilege).  It can be
242b15cb3dSCy Schubertrun as an interactive command or from a
252b15cb3dSCy Schubert.Ic cron
262b15cb3dSCy Schubertjob.
272b15cb3dSCy SchubertNTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
282b15cb3dSCy Schubertare defined and described by RFC 5905.
292b15cb3dSCy Schubert.Pp
302b15cb3dSCy SchubertThe default is to write the estimated correct local date and time (i.e. not
312b15cb3dSCy SchubertUTC) to the standard output in a format like:
322b15cb3dSCy Schubert.Ic "'1996\-10\-15 20:17:25.123 (+0800) +4.567 +/\- 0.089 [host] IP sN'"
332b15cb3dSCy Schubertwhere the
342b15cb3dSCy Schubert.Ic "'(+0800)'"
352b15cb3dSCy Schubertmeans that to get to UTC from the reported local time one must
362b15cb3dSCy Schubertadd 8 hours and 0 minutes,
372b15cb3dSCy Schubertthe
382b15cb3dSCy Schubert.Ic "'+4.567'"
392b15cb3dSCy Schubertindicates the local clock is 4.567 seconds behind the correct time
402b15cb3dSCy Schubert(so 4.567 seconds must be added to the local clock to get it to be correct).
412b15cb3dSCy SchubertNote that the number of decimals printed for this value will change
422b15cb3dSCy Schubertbased on the reported precision of the server.
432b15cb3dSCy Schubert.Ic "'+/\- 0.089'"
442b15cb3dSCy Schubertis the reported
452b15cb3dSCy Schubert.Em synchronization distance
462b15cb3dSCy Schubert(in seconds), which represents the maximum error due to all causes.
472b15cb3dSCy SchubertIf the server does not report valid data needed to calculate the
482b15cb3dSCy Schubertsynchronization distance, this will be reported as
492b15cb3dSCy Schubert.Ic "'+/\- ?'" .
502b15cb3dSCy SchubertIf the
512b15cb3dSCy Schubert.Em host
522b15cb3dSCy Schubertis different from the
532b15cb3dSCy Schubert.Em IP ,
542b15cb3dSCy Schubertboth will be displayed.
552b15cb3dSCy SchubertOtherwise, only the
562b15cb3dSCy Schubert.Em IP
572b15cb3dSCy Schubertis displayed.
582b15cb3dSCy SchubertFinally, the
592b15cb3dSCy Schubert.Em stratum
60*a25439b6SCy Schubertof the host is reported
61*a25439b6SCy Schubertand the leap indicator is decoded and displayed.
622b15cb3dSCy Schubert.Sh "OPTIONS"
632b15cb3dSCy Schubert.Bl -tag
642b15cb3dSCy Schubert.It  Fl 4 , Fl \-ipv4
652b15cb3dSCy SchubertForce IPv4 DNS name resolution.
662b15cb3dSCy SchubertThis option must not appear in combination with any of the following options:
672b15cb3dSCy Schubertipv6.
682b15cb3dSCy Schubert.sp
692b15cb3dSCy SchubertForce DNS resolution of the following host names on the command line
702b15cb3dSCy Schubertto the IPv4 namespace.
712b15cb3dSCy Schubert.It  Fl 6 , Fl \-ipv6
722b15cb3dSCy SchubertForce IPv6 DNS name resolution.
732b15cb3dSCy SchubertThis option must not appear in combination with any of the following options:
742b15cb3dSCy Schubertipv4.
752b15cb3dSCy Schubert.sp
762b15cb3dSCy SchubertForce DNS resolution of the following host names on the command line
772b15cb3dSCy Schubertto the IPv6 namespace.
782b15cb3dSCy Schubert.It  Fl a Ar auth\-keynumber , Fl \-authentication Ns = Ns Ar auth\-keynumber
792b15cb3dSCy SchubertEnable authentication with the key \fBauth\-keynumber\fP.
802b15cb3dSCy SchubertThis option takes an integer number as its argument.
812b15cb3dSCy Schubert.sp
822b15cb3dSCy SchubertEnable authentication using the key specified in this option's
832b15cb3dSCy Schubertargument.  The argument of this option is the \fBkeyid\fP, a
842b15cb3dSCy Schubertnumber specified in the \fBkeyfile\fP as this key's identifier.
852b15cb3dSCy SchubertSee the \fBkeyfile\fP option (\fB\-k\fP) for more details.
862b15cb3dSCy Schubert.It  Fl b Ar broadcast\-address , Fl \-broadcast Ns = Ns Ar broadcast\-address
872b15cb3dSCy SchubertListen to the address specified for broadcast time sync.
882b15cb3dSCy SchubertThis option may appear an unlimited number of times.
892b15cb3dSCy Schubert.sp
902b15cb3dSCy SchubertIf specified \fBsntp\fP will listen to the specified address
912b15cb3dSCy Schubertfor NTP broadcasts.  The default maximum wait time
922b15cb3dSCy Schubertcan (and probably should) be modified with \fB\-t\fP.
932b15cb3dSCy Schubert.It  Fl c Ar host\-name , Fl \-concurrent Ns = Ns Ar host\-name
942b15cb3dSCy SchubertConcurrently query all IPs returned for host\-name.
952b15cb3dSCy SchubertThis option may appear an unlimited number of times.
962b15cb3dSCy Schubert.sp
972b15cb3dSCy SchubertRequests from an NTP "client" to a "server" should never be sent
982b15cb3dSCy Schubertmore rapidly than one every 2 seconds.  By default, any IPs returned
992b15cb3dSCy Schubertas part of a DNS lookup are assumed to be for a single instance of
1002b15cb3dSCy Schubert\fBntpd\fP, and therefore \fBsntp\fP will send queries to these IPs
1012b15cb3dSCy Schubertone after another, with a 2\-second gap in between each query.
1022b15cb3dSCy Schubert.sp
1032b15cb3dSCy SchubertThe \fB\-c\fP or \fB\-\-concurrent\fP flag says that any IPs
1042b15cb3dSCy Schubertreturned for the DNS lookup of the supplied host\-name are on
1052b15cb3dSCy Schubertdifferent machines, so we can send concurrent queries.
1062b15cb3dSCy Schubert.It  Fl d , Fl \-debug\-level
1072b15cb3dSCy SchubertIncrease debug verbosity level.
1082b15cb3dSCy SchubertThis option may appear an unlimited number of times.
1092b15cb3dSCy Schubert.sp
1102b15cb3dSCy Schubert.It  Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
1112b15cb3dSCy SchubertSet the debug verbosity level.
1122b15cb3dSCy SchubertThis option may appear an unlimited number of times.
1132b15cb3dSCy SchubertThis option takes an integer number as its argument.
1142b15cb3dSCy Schubert.sp
1152b15cb3dSCy Schubert.It  Fl g Ar milliseconds , Fl \-gap Ns = Ns Ar milliseconds
1162b15cb3dSCy SchubertThe gap (in milliseconds) between time requests.
1172b15cb3dSCy SchubertThis option takes an integer number as its argument.
1182b15cb3dSCy SchubertThe default
1192b15cb3dSCy Schubert.Ar milliseconds
1202b15cb3dSCy Schubertfor this option is:
1212b15cb3dSCy Schubert.ti +4
1222b15cb3dSCy Schubert 50
1232b15cb3dSCy Schubert.sp
1242b15cb3dSCy SchubertSince we're only going to use the first valid response we get and
1252b15cb3dSCy Schubertthere is benefit to specifying a good number of servers to query,
1262b15cb3dSCy Schubertseparate the queries we send out by the specified number of
1272b15cb3dSCy Schubertmilliseconds.
1282b15cb3dSCy Schubert.It  Fl K Ar file\-name , Fl \-kod Ns = Ns Ar file\-name
1292b15cb3dSCy SchubertKoD history filename.
1302b15cb3dSCy SchubertThe default
1312b15cb3dSCy Schubert.Ar file\-name
1322b15cb3dSCy Schubertfor this option is:
1332b15cb3dSCy Schubert.ti +4
1342b15cb3dSCy Schubert /var/db/ntp\-kod
1352b15cb3dSCy Schubert.sp
1362b15cb3dSCy SchubertSpecifies the filename to be used for the persistent history of KoD
1372b15cb3dSCy Schubertresponses received from servers.  If the file does not exist, a
1382b15cb3dSCy Schubertwarning message will be displayed.  The file will not be created.
1392b15cb3dSCy Schubert.It  Fl k Ar file\-name , Fl \-keyfile Ns = Ns Ar file\-name
1402b15cb3dSCy SchubertLook in this file for the key specified with \fB\-a\fP.
1412b15cb3dSCy Schubert.sp
1422b15cb3dSCy SchubertThis option specifies the keyfile.
1432b15cb3dSCy Schubert\fBsntp\fP will search for the key specified with \fB\-a\fP
1442b15cb3dSCy Schubert\fIkeyno\fP in this file.  See \fBntp.keys(5)\fP for more
1452b15cb3dSCy Schubertinformation.
1462b15cb3dSCy Schubert.It  Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name
1472b15cb3dSCy SchubertLog to specified logfile.
1482b15cb3dSCy Schubert.sp
1492b15cb3dSCy SchubertThis option causes the client to write log messages to the specified
1502b15cb3dSCy Schubert\fIlogfile\fP.
1512b15cb3dSCy Schubert.It  Fl M Ar number , Fl \-steplimit Ns = Ns Ar number
1522b15cb3dSCy SchubertAdjustments less than \fBsteplimit\fP msec will be slewed.
1532b15cb3dSCy SchubertThis option takes an integer number as its argument.
1542b15cb3dSCy SchubertThe value of
1552b15cb3dSCy Schubert.Ar number
1562b15cb3dSCy Schubertis constrained to being:
1572b15cb3dSCy Schubert.in +4
1582b15cb3dSCy Schubert.nf
1592b15cb3dSCy Schubert.na
1602b15cb3dSCy Schubertgreater than or equal to 0
1612b15cb3dSCy Schubert.fi
1622b15cb3dSCy Schubert.in -4
1632b15cb3dSCy Schubert.sp
1642b15cb3dSCy SchubertIf the time adjustment is less than \fIsteplimit\fP milliseconds,
1652b15cb3dSCy Schubertslew the amount using \fBadjtime(2)\fP.  Otherwise, step the
1662b15cb3dSCy Schubertcorrection using \fBsettimeofday(2)\fP.  The default value is 0,
1672b15cb3dSCy Schubertwhich means all adjustments will be stepped.  This is a feature, as
1682b15cb3dSCy Schubertdifferent situations demand different values.
1692b15cb3dSCy Schubert.It  Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number
1702b15cb3dSCy SchubertSend \fBint\fP as our NTP protocol version.
1712b15cb3dSCy SchubertThis option takes an integer number as its argument.
1722b15cb3dSCy SchubertThe value of
1732b15cb3dSCy Schubert.Ar number
1742b15cb3dSCy Schubertis constrained to being:
1752b15cb3dSCy Schubert.in +4
1762b15cb3dSCy Schubert.nf
1772b15cb3dSCy Schubert.na
1782b15cb3dSCy Schubertin the range  0 through 7
1792b15cb3dSCy Schubert.fi
1802b15cb3dSCy Schubert.in -4
1812b15cb3dSCy SchubertThe default
1822b15cb3dSCy Schubert.Ar number
1832b15cb3dSCy Schubertfor this option is:
1842b15cb3dSCy Schubert.ti +4
1852b15cb3dSCy Schubert 4
1862b15cb3dSCy Schubert.sp
1872b15cb3dSCy SchubertWhen sending requests to a remote server, tell them we are running
1882b15cb3dSCy SchubertNTP protocol version \fIntpversion\fP .
1892b15cb3dSCy Schubert.It  Fl r , Fl \-usereservedport
1902b15cb3dSCy SchubertUse the NTP Reserved Port (port 123).
1912b15cb3dSCy Schubert.sp
1922b15cb3dSCy SchubertUse port 123, which is reserved for NTP, for our network
1932b15cb3dSCy Schubertcommunications.
1942b15cb3dSCy Schubert.It  Fl S , Fl \-step
1952b15cb3dSCy SchubertOK to 'step' the time with \fBsettimeofday(2)\fP.
1962b15cb3dSCy Schubert.sp
1972b15cb3dSCy Schubert.It  Fl s , Fl \-slew
1982b15cb3dSCy SchubertOK to 'slew' the time with \fBadjtime(2)\fP.
1992b15cb3dSCy Schubert.sp
2002b15cb3dSCy Schubert.It  Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds
2012b15cb3dSCy SchubertThe number of seconds to wait for responses.
2022b15cb3dSCy SchubertThis option takes an integer number as its argument.
2032b15cb3dSCy SchubertThe default
2042b15cb3dSCy Schubert.Ar seconds
2052b15cb3dSCy Schubertfor this option is:
2062b15cb3dSCy Schubert.ti +4
2072b15cb3dSCy Schubert 5
2082b15cb3dSCy Schubert.sp
2092b15cb3dSCy SchubertWhen waiting for a reply, \fBsntp\fP will wait the number
2102b15cb3dSCy Schubertof seconds specified before giving up.  The default should be
2112b15cb3dSCy Schubertmore than enough for a unicast response.  If \fBsntp\fP is
2122b15cb3dSCy Schubertonly waiting for a broadcast response a longer timeout is
2132b15cb3dSCy Schubertlikely needed.
2142b15cb3dSCy Schubert.It  Fl \-wait , " Fl \-no\-wait"
2152b15cb3dSCy SchubertWait for pending replies (if not setting the time).
2162b15cb3dSCy SchubertThe \fIno\-wait\fP form will disable the option.
2172b15cb3dSCy SchubertThis option is enabled by default.
2182b15cb3dSCy Schubert.sp
2192b15cb3dSCy SchubertIf we are not setting the time, wait for all pending responses.
2202b15cb3dSCy Schubert.It Fl \&? , Fl \-help
2212b15cb3dSCy SchubertDisplay usage information and exit.
2222b15cb3dSCy Schubert.It Fl \&! , Fl \-more\-help
2232b15cb3dSCy SchubertPass the extended usage information through a pager.
2242b15cb3dSCy Schubert.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
2252b15cb3dSCy SchubertSave the option state to \fIcfgfile\fP.  The default is the \fIlast\fP
2262b15cb3dSCy Schubertconfiguration file listed in the \fBOPTION PRESETS\fP section, below.
2272b15cb3dSCy SchubertThe command will exit after updating the config file.
2282b15cb3dSCy Schubert.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
2292b15cb3dSCy SchubertLoad options from \fIcfgfile\fP.
2302b15cb3dSCy SchubertThe \fIno\-load\-opts\fP form will disable the loading
2312b15cb3dSCy Schubertof earlier config/rc/ini files.  \fI\-\-no\-load\-opts\fP is handled early,
2322b15cb3dSCy Schubertout of order.
2332b15cb3dSCy Schubert.It Fl \-version Op Brq Ar v|c|n
2342b15cb3dSCy SchubertOutput version of program and exit.  The default mode is `v', a simple
2352b15cb3dSCy Schubertversion.  The `c' mode will print copyright information and `n' will
2362b15cb3dSCy Schubertprint the full copyright notice.
2372b15cb3dSCy Schubert.El
2382b15cb3dSCy Schubert.Sh "OPTION PRESETS"
2392b15cb3dSCy SchubertAny option that is not marked as \fInot presettable\fP may be preset
2402b15cb3dSCy Schubertby loading values from configuration ("RC" or ".INI") file(s) and values from
2412b15cb3dSCy Schubertenvironment variables named:
2422b15cb3dSCy Schubert.nf
2432b15cb3dSCy Schubert  \fBSNTP_<option\-name>\fP or \fBSNTP\fP
2442b15cb3dSCy Schubert.fi
2452b15cb3dSCy Schubert.ad
2462b15cb3dSCy SchubertThe environmental presets take precedence (are processed later than)
2472b15cb3dSCy Schubertthe configuration files.
2482b15cb3dSCy SchubertThe \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
2492b15cb3dSCy SchubertIf any of these are directories, then the file \fI.ntprc\fP
2502b15cb3dSCy Schubertis searched for within those directories.
2512b15cb3dSCy Schubert.Sh USAGE
2522b15cb3dSCy Schubert.Bl -tag -width indent
2532b15cb3dSCy Schubert.It Li "sntp ntpserver.somewhere"
2542b15cb3dSCy Schubertis the simplest use of this program
2552b15cb3dSCy Schubertand can be run as an unprivileged command
2562b15cb3dSCy Schubertto check the current time and error in the local clock.
2572b15cb3dSCy Schubert.It Li "sntp \-Ss \-M 128 ntpserver.somewhere"
2582b15cb3dSCy SchubertWith suitable privilege,
2592b15cb3dSCy Schubertrun as a command
2602b15cb3dSCy Schubertor from a
2612b15cb3dSCy Schubert.Xr cron 8
2622b15cb3dSCy Schubertjob,
2632b15cb3dSCy Schubert.Ic "sntp \-Ss \-M 128 ntpserver.somewhere"
2642b15cb3dSCy Schubertwill request the time from the server,
2652b15cb3dSCy Schubertand if that server reports that it is synchronized
2662b15cb3dSCy Schubertthen if the offset adjustment is less than 128 milliseconds
2672b15cb3dSCy Schubertthe correction will be slewed,
2682b15cb3dSCy Schubertand if the correction is more than 128 milliseconds
2692b15cb3dSCy Schubertthe correction  will be stepped.
2702b15cb3dSCy Schubert.It Li "sntp \-S ntpserver.somewhere"
2712b15cb3dSCy SchubertWith suitable privilege,
2722b15cb3dSCy Schubertrun as a command
2732b15cb3dSCy Schubertor from a
2742b15cb3dSCy Schubert.Xr cron 8
2752b15cb3dSCy Schubertjob,
2762b15cb3dSCy Schubert.Ic "sntp \-S ntpserver.somewhere"
2772b15cb3dSCy Schubertwill set (step) the local clock from a synchronized specified server,
2782b15cb3dSCy Schubertlike the (deprecated)
2792b15cb3dSCy Schubert.Xr ntpdate 1ntpdatemdoc ,
2802b15cb3dSCy Schubertor
2812b15cb3dSCy Schubert.Xr rdate 8
2822b15cb3dSCy Schubertcommands.
2832b15cb3dSCy Schubert.El
2842b15cb3dSCy Schubert.Sh "ENVIRONMENT"
2852b15cb3dSCy SchubertSee \fBOPTION PRESETS\fP for configuration environment variables.
2862b15cb3dSCy Schubert.Sh "FILES"
2872b15cb3dSCy SchubertSee \fBOPTION PRESETS\fP for configuration files.
2882b15cb3dSCy Schubert.Sh "EXIT STATUS"
2892b15cb3dSCy SchubertOne of the following exit values will be returned:
2902b15cb3dSCy Schubert.Bl -tag
2912b15cb3dSCy Schubert.It 0 " (EXIT_SUCCESS)"
2922b15cb3dSCy SchubertSuccessful program execution.
2932b15cb3dSCy Schubert.It 1 " (EXIT_FAILURE)"
2942b15cb3dSCy SchubertThe operation failed or the command syntax was not valid.
2952b15cb3dSCy Schubert.It 66 " (EX_NOINPUT)"
2962b15cb3dSCy SchubertA specified configuration file could not be loaded.
2972b15cb3dSCy Schubert.It 70 " (EX_SOFTWARE)"
2982b15cb3dSCy Schubertlibopts had an internal operational error.  Please report
2992b15cb3dSCy Schubertit to autogen\-users@lists.sourceforge.net.  Thank you.
3002b15cb3dSCy Schubert.El
3012b15cb3dSCy Schubert.Sh AUTHORS
3022b15cb3dSCy Schubert.An "Johannes Maximilian Kuehn"
3032b15cb3dSCy Schubert.An "Harlan Stenn"
3042b15cb3dSCy Schubert.An "Dave Hart"
3052b15cb3dSCy Schubert.Sh "COPYRIGHT"
3062b15cb3dSCy SchubertCopyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
3072b15cb3dSCy SchubertThis program is released under the terms of the NTP license, <http://ntp.org/license>.
3082b15cb3dSCy Schubert.Sh "BUGS"
3092b15cb3dSCy SchubertPlease send bug reports to: http://bugs.ntp.org, bugs@ntp.org
3102b15cb3dSCy Schubert.Sh "NOTES"
3112b15cb3dSCy SchubertThis manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP
3122b15cb3dSCy Schubertoption definitions.
313