# Miscellaneous Commands and Options

| from Pogo, Walt Kelly We have three, now looking for more.

## 1. Related Links

## 2. Miscellaneous Commands and Options

- driftfile - specify frequency file

- enable - enable options

- disable - disable options

- includefile - specify include file

- interface - specify which local network addresses to use

- leapfile - specify leap seconds file

- logconfig - configure log file

- mru - control monitor MRU list limits

- phone - specify modem phone numbers

- reset - reset groups of counters

- setvar - set system variables

- tinker - modify sacred system parameters (dangerous)

- rlimit - alters certain process storage allocation limits

- tos - modify service parameters

- Command Index

## 3. Commands and Options

driftfile driftfile

  This command specifies the complete path and name of the file used to record the frequency of the local clock oscillator; this is the same operation as the -f command line option. If the file exists, it is read at startup to set the initial frequency and then updated once per hour with the current frequency computed by the daemon. If the file name is specified, but the file itself does not exist, ntpd starts with an initial frequency of zero and creates the file when writing it for the first time. If this command is not given, the daemon will always start with an initial frequency of zero.

  The file format consists of a single line containing a single floating point number, which records the frequency offset measured in parts-per-million (PPM). The file is updated by first writing the current drift value into a temporary file and then renaming this file to replace the old version; this implies that ntpd(8) must have write permission for the directory the drift file is located in, and that file system links, symbolic or otherwise, should be avoided.

enable [auth | calibrate | kernel | monitor | ntp | stats]; disable [auth | calibrate | kernel | monitor | ntp | stats]

  Provides a way to enable or disable various server options. Flags not mentioned are unaffected. Note that all of these flags can be controlled remotely using the ntpq(1) utility program.

  auth

    Enables the server to synchronize with unconfigured peers only if the peer has been correctly authenticated. The default for this flag is enable.

  calibrate

    Enables the calibrate feature for reference clocks. The default for this flag is disable.

  kernel

    Enables the kernel time discipline, if available. The default for this flag is enable if support is available, otherwise disable.

  monitor

    Enables the monitoring facility. See the ntpq(1) program and the monlist command for further information. The default for this flag is enable.

  ntp

    Enables time and frequency discipline. In effect, this switch opens and closes the feedback loop, which is useful for testing. The default for this flag is enable.

  stats

    Enables the statistics facility. See the "Monitoring Options" section for further information. The default for this flag is disable.

includefile includefile

  This command allows additional configuration commands to be included from a separate file. Include files may be nested to a depth of five; upon reaching the end of any include file, command processing resumes in the previous configuration file. Relative pathnames are evaluated not with respect to the current working directory but with respect to the directory name of the last pushed file in the stack. This option is useful for sites that run ntpd(8) on multiple hosts, with (mostly) common options (e.g., a restriction list).

interface [listen | ignore | drop] [all | ipv4 | ipv6 | wildcard | name | address[/prefixlen]]

  This command controls which network addresses ntpd opens, and whether the input is dropped without processing. The first parameter determines the action on addresses which match the second parameter. That parameter specifies a class of addresses, or a specific interface name, or an address. In the address case, prefixlen determines how many bits must match for this rule to apply. ignore prevents opening matching addresses, drop causes ntpd to open the address and drop all received packets without examination. Multiple interface commands can be used. The last rule which matches a particular address determines the action for it. interface commands are disabled if any of the -I, --interface,-L, or --novirtualips command-line options are used. If none of those options are used, and no interface actions are specified in the configuration file, all available network addresses are opened. The nic command is an alias for interface.

leapfile leapfile

  This command loads the NIST leap seconds file and initializes the leapsecond values for the next leap second time, expiration time and TAI offset. The file can be obtained using ntpleapfetch.

  The leapfile is scanned when ntpd processes the leapfile directive or when ntpd detects that leapfile has changed. ntpd checks once an hour to see if the leapfile has changed.

leapsmearinterval interval

  This experimental option is only available if ntpd was built with the --enable-leap-smear option, It specifies the interval over which a leap second correction will be applied. Recommended values for this option are between 7200 (2 hours) and 86400 (24 hours). DO NOT USE THIS OPTION ON PUBLIC-ACCESS SERVERS! See http://bugs.ntp.org/2855 for more information.

logconfig configkeyword

  This command controls the amount and type of output written to the system syslog(3) facility or the alternate log file. By default, all output is turned on. All configkeyword keywords can be prefixed with ‘=’, ‘’ and ‘-’, where ‘=’ sets the syslog(3) priority mask, ‘’ adds and ‘-’ removes messages. syslog(3) messages can be controlled in four classes (clock,peer,sys and sync). Within these classes four types of messages can be controlled: informational messages (info), event messages (events), statistics messages (statistics) and status messages (status).

  Configuration keywords are formed by concatenating the message class with the event class. The all prefix can be used instead of a message class. A message class may also be followed by the all keyword to enable/disable all messages of the respective message class. Thus, a minimal log configuration could look like this:

      logconfig =syncstatus +sysevents

  This would just list the synchronizations state of ntpd(8) and the major system events. For a simple reference server, the following minimum message configuration could be useful:

      logconfig =syncall +clockall

  This configuration will list all clock information and synchronization information. All other events and messages about peers, system events and so on is suppressed.

logfile logfile

  This command specifies the location of an alternate log file to be used instead of the default system syslog(3) facility; this is the same operation as the -l command line option.

If your ntpd runs for a long time, you probably want to use logrotate or newsyslog to switch to a new log file occasionally. SIGHUP will reopen the log file.

mru [maxdepth count | maxmem kilobytes | mindepth count | maxage seconds | minage seconds | initalloc count | initmem kilobytes | incalloc count | incmem kilobytes]

  Controls size limits of the monitoring facility Most Recently Used (MRU) list of client addresses, which is also used by the rate control facility.

  maxdepth count
  maxmem kilobytes

    Equivalent upper limits on the size of the MRU list, in terms of entries or kilobytes. The actual limit will be up to incalloc entries or incmem kilobytes larger. As with all of the mru options offered in units of entries or kilobytes, if both maxdepth and maxmem are used, the last one used controls. The default is 1024 kilobytes.

  mindepth count

    The lower limit on the MRU list size. When the MRU list has fewer than mindepth entries, existing entries are never removed to make room for newer ones, regardless of their age. The default is 600 entries.

  maxage seconds
  minage seconds

    If an address is not in the list, there are several possible ways to find a slot for it.

    1. If the list has fewer than mindepth entries, a slot is allocated from the free list; this is the normal case for a server without a lot of clients. If clients come and go, for example, laptops going between home and work, the default setup shows only the long term average.

    2. If the age of the oldest slot is greater than maxage, the oldest slot is recycled (default 3600 seconds).

    3. If the freelist is not empty, a slot is allocated from the free list.

    4. If the freelist is empty but not full (see maxmem), more memory is allocated (see incmem) and, a new slot is used.

    5. If the age of the oldest slot is more than minage, the oldest slot is recycled (default 64 seconds).

    6. Otherwise, no slot is available.

  initalloc count
  initmem kilobytes

    Initial memory allocation at the time the monitoring facility is first enabled, in terms of entries or kilobytes. The default is 4 kilobytes.

  incalloc count
  incmem kilobytes

    Size of additional memory allocations when growing the MRU list, in entries or kilobytes. The default is 4 kilobytes.

nonvolatile threshold

  Specify the threshold in seconds to write the frequency file, with a default of 1e-7 (0.1 PPM). The frequency file is inspected each hour. If the difference between the current frequency and the last value written exceeds the threshold, the file is written, and the threshold becomes the new threshold value. If the threshold is not exceeded, it is reduced by half; this is intended to reduce the frequency of unnecessary file writes for embedded systems with nonvolatile memory.

phone dial …

  This command is used in conjunction with the ACTS modem driver (type modem) or the JJY driver (type jjy). For ACTS, the arguments consist of a maximum of 10 telephone numbers used to dial USNO, NIST or European time services. For the jjy driver in modes 100-180, the argument is one telephone number used to dial the telephone JJY service. The Hayes command ATDT is normally prepended to the number, which can contain other modem control codes as well.

reset [allpeers] [auth] [ctl] [io] [mem] [sys] [timer]

  Reset one or more groups of counters maintained by ntpd and exposed by ntpq.

setvar variable [default]

  This command adds a system variable. These variables can be used to distribute additional information such as the access policy. If the variable of the form name=value is followed by the default keyword, the variable will be listed as part of the default system variables (ntpq(1) rv command). These additional variables serve informational purposes only. They are not related to the protocol other that they can be listed. The known protocol variables will always override any variables defined via the setvar mechanism. There are three special variables that contain the names of all variable of the same group. The sys_var_list holds the names of all system variables. The peer_var_list holds the names of all peer variables and the clock_var_list holds the names of the reference clock variables.

extra [port portnum ]

  This is a catchall for various adjustments. There is only one now.

  port portnum

    (same as nts port portnum) This opens another port. NTS-KE will tell clients to use this port. This might help bypass ISP blocking on port 123. Be sure that your firewall doesn’t block traffic arriving on this new port. It will also be used as the return port when sending requests. Again, that bypasses blocking on port 123.

tinker [allan allan | dispersion dispersion | freq freq | huffpuff huffpuff | panic panic | step step | stepback stepback | stepfwd stepfwd | stepout stepout]

  This command can be used to alter several system variables in very exceptional circumstances. It should occur in the configuration file before any other configuration options. The default values of these variables have been carefully optimized for a wide range of network speeds and reliability expectations. In general, they interact in intricate ways that are hard to predict, and some combinations can result in some very nasty behavior. Very rarely is it necessary to change the default values; but, some folks cannot resist twisting the knobs anyway, and this command is for them. Emphasis added: twisters are on their own and can expect no help from the support group.

  The variables operate as follows:

  allan allan

    The argument becomes the new value for the minimum Allan intercept, which is a parameter of the PLL/FLL clock discipline algorithm. The value in log2 seconds defaults to 11 (2048 s), which is also the lower limit.

  dispersion dispersion

    The argument becomes the new value for the dispersion increase rate, normally .000015 s/s.

  freq freq

    The argument becomes the initial value of the frequency offset in parts-per-million; this overrides the value in the frequency file, if present, and avoids the initial training state if it is not.

  huffpuff huffpuff

    The argument becomes the new value for the experimental huff-n'-puff filter span, which determines the most recent interval the algorithm will search for a minimum delay. The lower limit is 900 s (15 m), but a more reasonable value is 7200 (2 hours). There is no default since the filter is not enabled unless this command is given.

  panic panic

    The argument is the panic threshold, normally 1000 s. If set to zero, the panic sanity check is disabled, and a clock offset of any value will be accepted.

  step step

    The argument is the step threshold, which by default is 0.128 sec. It can be set to any positive number in seconds. If set to zero, step adjustments will never occur. Note: The kernel time discipline is disabled if the step threshold is set to zero or greater than the default.

  stepback stepback

    The argument is the step threshold for the backward direction, which by default is 0.128 sec. It can be set to any positive number in seconds. If both the forward and backward step thresholds are set to zero, step adjustments will never occur. Note: The kernel time discipline is disabled if each direction of step threshold are either set to zero or greater than .5 second.

  stepfwd stepfwd

    As for stepback, but for the forward direction.

  stepout stepout

    The argument is the stepout timeout, which by default is 900 s. It can be set to any positive number in seconds. If set to zero, the stepout pulses will not be suppressed.

rlimit [memlock megabytes | stacksize 4kPages | filenum filedescriptors]
  memlock megabytes

    Ignored for backward compatibility.

  stacksize 4kPages

    Specifies the maximum size of the process stack on systems with the mlockall() function. Defaults to 50 4k pages.

  filenum filedescriptors

    Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.

tos [ceiling ceiling | floor floor | maxclock maxclock | maxdist maxdist | minclock minclock | mindist mindist | minsane minsane | orphan stratum | orphanwait delay]

  This command alters certain system variables used by the clock selection and clustering algorithms. The default values of these variables have been carefully optimized for a wide range of network speeds and reliability expectations. Very rarely is it necessary to change the default values; but, some folks can’t resist twisting the knobs. It can be used to select the quality and quantity of peers used to synchronize the system clock and is most useful in dynamic server discovery schemes. The options are as follows:

  ceiling ceiling

    Specify the maximum stratum (exclusive) for acceptable server packets. The default is 16. See the Automatic Server Discovery page for further details.

  floor floor

    Specify the minimum stratum (inclusive) for acceptable server packets. The default is 1. See the Automatic Server Discovery page for further details.

  maxclock maxclock

    Specify the maximum number of servers retained by the server discovery schemes. The default is 10, which should typically be changed. This should be an odd number (to most effectively outvote falsetickers) typically two or three more than minclock, plus the number of pool entries. The pool entries must be added as maxclock, but not minclock, also counts the pool entries themselves. For example, tos maxclock 11 with four pool lines would keep 7 associations. See the Automatic Server Discovery page for further details.

  maxdist maxdistance

    Specify the synchronization distance threshold used by the clock selection algorithm. The default is 1.5 s. This determines both the minimum number of packets to set the system clock and the maximum roundtrip delay. It can be decreased to improve reliability or increased to synchronize clocks on the Moon or planets.

  maxdisp maxdispersion

    Specify the maximum dispersion used by the clock synchronization algorithm. The default is 16 s. This is also the dispersion assigned to missing data. See RFC 5905 for discussion.

  minclock minclock

    Specify the number of servers used by the clustering algorithm as the minimum to include on the candidate list. The default is 3. This is also the number of servers to be averaged by the combining algorithm.

  mindist mindistance

    Specify the minimum distance used by the selection and anticlockhop algorithm. Larger values increase the tolerance for outliers; smaller values increase the selectivity. The default is .001 s. In some cases, such as reference clocks with high jitter and a PPS signal, it is useful to increase the value to insure the intersection interval is always nonempty.

  minsane minsane

    Specify the number of servers used by the selection algorithm as the minimum to set the system clock. The default is 1 for legacy purposes; however, for critical applications the value should be somewhat higher (e.g. 3) but less than minclock.

  orphan stratum

    Specify the orphan stratum with default 16. If less than 16 this is the stratum assumed by the root servers. See the Orphan Mode page for further details.

  orphanwait delay

    Specify the delay in seconds from the time all sources are lost until orphan parent mode is enabled with default 300 s (five minutes). During this period, the local clock driver and the modem driver are not selectable, unless marked with the prefer keyword. This allows time for one or more primary sources to become reachable and selectable before using backup sources, and avoids transient use of the backup sources at startup.

dscp dscp

  This command specifies the Differentiated Services Code Point (DSCP) value that is used in sent NTP packets. The default value is 46 for Expedited Forwarding (EF).

Home Page | Site Map | Contacts