User guide for the chrony suite


Next: , Up: (dir)

User guide for the chrony suite


Next: , Previous: Top, Up: Top

1 Introduction


Next: , Up: Introduction

1.1 Overview

Chrony is a software package for maintaining the accuracy of computer system clocks. It consists of a pair of programs :


Next: , Previous: Overview, Up: Introduction

1.2 Acknowledgements

The chrony suite makes use of the algorithm known as RSA Data Security, Inc. MD5 Message-Digest Algorithm for authenticating messages between different machines on the network.

In writing the chronyd program, extensive use has been made of RFC1305, written by David Mills. I have occasionally referred to the xntp suite's source code to check details of the protocol that the RFC did not make absolutely clear. The core algorithms in chronyd are all completely distinct from xntp, however.


Next: , Previous: Acknowledgements, Up: Introduction

1.3 Availability


Next: , Up: Availability

1.3.1 Getting the software

Links on the chrony home page describe how to obtain the software.


Previous: Getting the software, Up: Availability

1.3.2 Platforms

Although most of the program is portable between Unix-like systems, there are parts that have to be tailored to each specific vendor's system. These are the parts that interface with the operating system's facilities for adjusting the system clock; different operating systems may provide different function calls to achieve this, and even where the same function is used it may have different quirks in its behaviour.

The software is known to work in the following environments:

Closely related systems may work too, but they have not been tested.

Porting the software to other system (particularly to those supporting an adjtime system call) should not be difficult, however it requires access to such systems to test out the driver.


Next: , Previous: Availability, Up: Introduction

1.4 Relationship to other software packages


Next: , Up: Other time synchronisation packages

1.4.1 xntpd

The `reference' implementation of the Network Time Protocol is the program xntpd, available via The NTP home page.

xntpd is designed to support all the operating modes defined by RFC1305, and has driver support for a large number of reference clocks (such as GPS receivers) that can be connected directly to a computer, thereby providing a so-called 'stratum 1' server.

Things chronyd can do that xntpd can't:

Things xntpd can do that chronyd can't:


Previous: Comparison with xntpd, Up: Other time synchronisation packages

1.4.2 timed

timed is a program that is part of the BSD networking suite. It uses broadcast packets to find all machines running the daemon within a subnet. The machines elect a master which periodically measures the system clock offsets of the other computers using ICMP timestamps. Corrections are sent to each member as a result of this process.

Problems that may arise with timed are :

timed does have the benefit over chronyd that for isolated networks of computers, they will track the `majority vote' time. For such isolated networks, chronyd requires one computer to be the `master' with the others slaved to it. If the master has a particular defective clock, the whole set of computers will tend to slip relative to real time (but they will stay accurate relative to one another).


Next: , Previous: Other time synchronisation packages, Up: Introduction

1.5 Distribution rights and (lack of) warranty

Chrony may be distributed in accordance with the GNU General Public License version 2, reproduced in See GPL.


Next: , Previous: Distribution and warranty, Up: Introduction

1.6 Bug reporting and suggestions

If you think you've found a bug in chrony, or have a suggestion, please let me know. My primary current email address is rc@rc0.org.uk. If that fails, you could try finding me through one of the chrony mailing lists, or by looking up my name on a search engine.

I can't promise a timescale to fix a bug; it depends a lot on the how complex the bug is to track down, as I have a lot of other calls on my time : 2 young children, my job, and indeed other free/open source software projects. However, I do intend to look into problems when time allows.

Another source of information to try is the chrony users mailing list. You can join this by sending an empty message to chrony-users-subscribe@sunsite.dk. Only subscribers can post to the list.

When you are reporting a bug, please send me all the information you can. Unfortunately, chrony has proven to be one of those programs where it is very difficult to reproduce bugs in a different environment. So I may have to interact with you quite a lot to obtain enough extra logging and tracing to pin-point the problem in some cases. Please be patient and plan for this!

Of course, if you can debug the problem yourself and send me a source code patch to fix it, I will be very grateful!


Previous: Bug reporting, Up: Introduction

1.7 Contributions

Although chrony is now a fairly mature and established project, there are still areas that could be improved. If you can program in C and have some expertise in these areas, you might be able to fill the gaps.

Particular areas I know need addressing are :

  1. Porting to other Unices

    This involves creating equivalents of sys_solaris.c, sys_linux.c etc for the new system. Note, the Linux driver has been reported as working on a range of different architectures (Alpha, Sparc, MIPS as well as x86 of course).

  2. Porting to Windows NT

    I did a small amount of work on this under Cygwin. Only the sorting out of the include files has really been achieved so far. The two main areas still to address are

    1. The system clock driver.
    2. How to make chronyd into an NT service (i.e. what to replace fork(), setsid() etc with so that chronyd can be automatically started in the system bootstrap.
  3. Hardware clock support
  4. Automation of the trimrtc and writertc mechanisms

    Currently, the RTC trimming mechanism is a manual operation, because there has to be a reasonable guarantee that the system will stay up for a reasonable length of time afterwards. (If it is shut down too soon, a poor characterisation of the RTC drift rate will be stored on disc, giving a bad system clock error when the system is next booted.)

    To make chrony more automated for the non-expert user, it would be useful if this problem could be avoided so that trimrtc could be done automatically (e.g. in a crontab, or as part of the ip-up or ip-down scripts.)


Next: , Previous: Introduction, Up: Top

2 Installation

The software is distributed as source code which has to be compiled. The source code is supplied in the form of a gzipped tar file, which unpacks to a subdirectory identifying the name and version of the program.

After unpacking the source code, change directory into it, and type

     ./configure

This is a shell script that automatically determines the system type. There is a single optional parameter, --prefix which indicates the directory tree where the software should be installed. For example,

     ./configure --prefix=/opt/free

will install the chronyd daemon into /opt/free/sbin and the chronyc control program into /opt/free/bin. The default value for the prefix is /usr/local.

The configure script assumes you want to use gcc as your compiler. If you want to use a different compiler, you can configure this way:

     CC=cc CFLAGS=-O ./configure --prefix=/opt/free

for Bourne-family shells, or

     setenv CC cc
     setenv CFLAGS -O
     ./configure --prefix=/opt/free

for C-family shells.

If the software cannot (yet) be built on your system, an error message will be shown. Otherwise, the files options.h and Makefile will be generated.

By default, chronyc will be built to make use of the readline library. If you don't want this, specify the –disable-readline flag to configure. If you have readline and/or ncurses installed in a non-standard location, please refer to see readline support for information.

Now type

     make

to build the programs.

If you want to build the manual in plain text, HTML and info versions, type

     make docs

Once the programs have been successfully compiled, they need to be installed in their target locations. This step normally needs to be performed by the superuser, and requires the following command to be entered.

     make install

This will install the binaries, plain text manual and manpages.

To install the HTML and info versions of the manual as well, enter the command

     make install-docs

If you want chrony to appear in the top level info directory listing, you need to run the install-info command manually after this step. install-info takes 2 arguments. The first is the path to the chrony.info file you have just installed. This will be the argument you gave to –prefix when you configured (/usr/local by default), with /info/chrony.info on the end. The second argument is the location of the file called dir. This will typically be /usr/info/dir. So the typical command line would be

     install-info /usr/local/info/chrony.info /usr/info/dir

Now that the software is successfully installed, the next step is to set up a configuration file. The contents of this depend on the network environment in which the computer operates. The Debian package installs a simple configuration file suitable for a dial-up pc. You should edit it to suit your situation. Typical scenarios are described in the following section of the document.


Next: , Up: Installation

2.1 Support for the readline library

By default, chronyc is built to make use of the readline library. This allows you to use the cursor keys to replay and edit old commands. If you don't want to use readline (in which case chronyc will use a minimal command line interface), invoke configure like this:

     ./configure --disable-readline other-options...

If you have readline and/or ncurses installed in locations that aren't normally searched by the compiler and linker, you need extra options if you want readline to be used:

--with-readline-includes=directory_name
This defines the name of the directory above the one where readline.h is. readline.h is assumed to be in a readline subdirectory of the named directory.
--with-readline-library=directory_name
This defines the directory containing the libreadline.a or libreadline.so file.
--with-ncurses-library=directory_name
This defines the directory containing the libncurses.a or libncurses.so file.


Previous: readline support, Up: Installation

2.2 Extra options for package builders

The configure and make procedures have some extra options that may be useful if you are building a distribution package for chrony.

The –infodir=DIR option to configure specifies a different install directory for the info files. This overrides the info subdirectory of the argument to the –prefix option. For example, you might use

     ./configure --prefix=/usr --infodir=/usr/share/info

The –mandir=DIR option to configure specifies a different install directory for the man pages. This overrides the man subdirectory of the argument to the –prefix option.

     ./configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man

to set both options together.

The final option is the DESTDIR option to the make command. For example, you could use the commands

     ./configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man
     make all docs
     make install DESTDIR=./tmp
     cd tmp
     tar cvf - . | gzip -9 > chrony.tar.gz

to build a package. When untarred within the root directory, this will install the files to the intended final locations.


Next: , Previous: Installation, Up: Top

3 Typical operating scenarios


Next: , Up: Typical scenarios

3.1 Computers connected to the internet

In this section we discuss how to configure chrony for computers that have permanent connections to the internet (or to any network containing true NTP servers which ultimately derive their time from a reference clock).

To operate in this mode, you will need to know the names of the NTP server machines you wish to use. You may be able to find names of suitable servers by one of the following methods:

Assuming that you have found some servers, you need to set up a configuration file to run chrony. The (compiled-in) default location for this file is /etc/chrony.conf. In the Debian package the configuration files are in the directory /etc/chrony. Assuming that your ntp servers are called a.b.c and d.e.f, your chrony.conf file could contain as a minimum

     server a.b.c
     server d.e.f
     server g.h.i

However, you will probably want to include some of the other directives described later. The following directives will be particularly useful : driftfile, commandkey, keyfile. The smallest useful configuration file would look something like

     server a.b.c
     server d.e.f
     server g.h.i
     keyfile /etc/chrony.keys
     commandkey 1
     driftfile /etc/chrony.drift


Next: , Previous: Computers on the net, Up: Typical scenarios

3.2 Infrequent connection to true NTP servers

In this section we discuss how to configure chrony for computers that have occasional connections to the internet.


Next: , Up: Infrequent connection

3.2.1 Setting up the configuration file for infrequent connections

As in the previous section, you will need access to NTP servers on the internet. The same remarks apply for how to find them.

In this case, you will need some additional configuration to tell chronyd when the connection to the internet goes up and down. This saves the program from continuously trying to poll the servers when they are inaccessible.

Again, assuming that your ntp servers are called a.b.c and d.e.f, your chrony.conf file would need to contain something like

     server a.b.c
     server d.e.f
     server g.h.i

However, the following issues need to be addressed:

  1. Your computer probably doesn't have DNS access whilst offline to turn the machine names into IP addresses.
  2. Your computer will keep trying to contact the servers to obtain timestamps, even whilst offline. If you operate a dial-on-demand system, things are even worse, because the link to the internet will keep getting established.

For this reason, it would be better to specify this part of your configuration file in the following way:

     server 1.2.3.4 offline
     server 5.6.7.8 offline
     server 9.10.11.12 offline

Because numeric IP addresses have been used, the first problem is overcome. The offline keyword indicates that the servers start in an offline state, and that they should not be contacted until chronyd receives notification that the link to the internet is present.

An alternative is to use the names of the NTP servers, and put entries for them into your /etc/hosts file. This will be OK as long as files comes before dns in the hosts line of the /etc/nsswitch.conf file.

In order to notify chronyd of the presence of the link, you will need to be able to log in to it with the program chronyc. To do this, chronyd needs to be configured with an administrator password. The Debian package puts a randomly generated key in /etc/chrony/chrony.keys. You should change it. To set up an administrator password, you can create a file /etc/chrony.keys containing a single line

     1 xyzzy

and add the following line to /etc/chrony.conf (the order of the lines does not matter)

     commandkey 1

The smallest useful configuration file would look something like

     server 1.2.3.4 offline
     server 5.6.7.8 offline
     server 9.10.11.12 offline
     keyfile /etc/chrony.keys
     commandkey 1
     driftfile /etc/chrony.drift

The next section describes how to tell chronyd when the internet link goes up and down.


Previous: Configuration for infrequent connections, Up: Infrequent connection

3.2.2 How to tell chronyd when the internet link is available.

To use this option, you will need to configure a command key in chronyd's configuration file /etc/chrony.conf, as described in the previous section.

To tell chronyd when to start and finish sampling the servers, the online and offline commands of chronyc need to be used. To give an example of their use, we assume that pppd is the program being used to connect to the internet, and that chronyc has been installed at its default location /usr/local/bin/chronyc. We also assume that the command key has been set up as described in the previous section.

In the file /etc/ppp/ip-up we add the command sequence

     /usr/local/bin/chronyc <<EOF
     password xyzzy
     online
     EOF

and in the file /etc/ppp/ip-down we add the sequence

     /usr/local/bin/chronyc <<EOF
     password xyzzy
     offline
     EOF

The Debian package puts scripts similar to those above in the directories /etc/ppp/ip-up.d and /etc/ppp/ip-down.d.

chronyd's polling of the servers will now only occur whilst the machine is actually connected to the Internet.


Next: , Previous: Infrequent connection, Up: Typical scenarios

3.3 Isolated networks

In this section we discuss how to configure chrony for computers that never have network conectivity to any computer which ultimately derives its time from a reference clock.

In this situation, one computer is selected to be the master timeserver. The other computers are either direct clients of the master, or clients of clients.

The rate value in the master's drift file needs to be set to the average rate at which the master gains or loses time. chronyd includes support for this, in the form of the manual directive in the configuration file and the settime command in the chronyc program.

If the master is rebooted, chronyd can re-read the drift rate from the drift file. However, the master has no accurate estimate of the current time. To get around this, the system can be configured so that the master can initially set itself to a `majority-vote' of selected clients' times; this allows the clients to `flywheel' the master across its outage.

A typical configuration file for the master (called master) might be (assuming the clients are in the 192.168.165.x subnet and that the master's address is 192.168.169.170)

     driftfile /etc/chrony.drift
     commandkey 25
     keyfile /etc/chrony.keys
     initstepslew 10 client1 client3 client6
     local stratum 8
     manual
     allow 192.168.165

For the clients that have to resynchronise the master when it restarts, the configuration file might be

     server master
     driftfile /etc/chrony.drift
     logdir /var/log/chrony
     log measurements statistics tracking
     keyfile /etc/chrony.keys
     commandkey 24
     local stratum 10
     initstepslew 20 master
     allow 192.168.169.170

The rest of the clients would be the same, except that the local and allow directives are not required.


Next: , Previous: Isolated networks, Up: Typical scenarios

3.4 The home PC with a dial-up connection


Next: , Up: Dial-up home PCs

3.4.1 Assumptions/how the software works

This section considers the home computer which has a dial-up connection. It assumes that Linux is run exclusively on the computer. Dual-boot systems may work; it depends what (if anything) the other system does to the system's real-time clock.

Much of the configuration for this case is discussed earlier (see Infrequent connection). This section addresses specifically the case of a computer which is turned off between 'sessions'.

In this case, chronyd relies on the computer's real-time clock (RTC) to maintain the time between the periods when it is powered up. The arrangement is shown in the figure below.

                 trim if required                          PSTN
           +---------------------------+               +----------+
           |                           |               |          |
           v                           |               |          |
     +---------+                    +-------+       +-----+     +---+
     | System's|  measure error/    |chronyd|       |modem|     |ISP|
     |real-time|------------------->|       |-------|     |     |   |
     |  clock  |   drift rate       +-------+       +-----+     +---+
     +---------+                       ^                          |
           |                           |                          |
           +---------------------------+                  --o-----o---
              set time at boot up                           |
                                                       +----------+
                                                       |NTP server|
                                                       +----------+

When the computer is connected to the Internet (via the modem), chronyd has access to external NTP servers which it makes measurements from. These measurements are saved, and straight-line fits are performed on them to provide an estimate of the computer's time error and rate of gaining/losing time.

When the computer is taken offline from the Internet, the best estimate of the gain/loss rate is used to free-run the computer until it next goes online.

Whilst the computer is running, chronyd makes measurements of the real-time clock (RTC) (via the /dev/rtc interface, which must be compiled into the kernel). An estimate is made of the RTC error at a particular RTC second, and the rate at which the RTC gains or loses time relative to true time.

The RTC is fully supported in 2.2, 2.4 and 2.6 kernels.

On 2.6 kernels, if your motherboard has a HPET, you need to enable the HPET_EMULATE_RTC option in your kernel configuration. Otherwise, chrony will not be able to interact with the RTC device and will give up using it.

For kernels in the 2.0 series prior to 2.0.32, the kernel was set up to trim the RTC every 11 minutes. This would be disasterous for chronyd – there is no reliable way of synchronising with this trimming. For this reason, chronyd only supports the RTC in 2.0 kernels from v2.0.32 onwards.

When the computer is powered down, the measurement histories for all the NTP servers are saved to files (if the dumponexit directive is specified in the configuration file), and the RTC tracking information is also saved to a file (if the rtcfile directive has been specified). These pieces of information are also saved if the dump and writertc commands respectively are issued through chronyc.

When the computer is rebooted, chronyd reads the current RTC time and the RTC information saved at the last shutdown. This information is used to set the system clock to the best estimate of what its time would have been now, had it been left running continuously. The measurement histories for the servers are then reloaded.

The next time the computer goes online, the previous sessions' measurements can contribute to the line-fitting process, which gives a much better estimate of the computer's gain/loss rate.

One problem with saving the measurements and RTC data when the machine is shut down is what happens if there is a power failure; the most recent data will not be saved. Although chronyd is robust enough to cope with this, some performance may be lost. (The main danger arises if the RTC has been changed during the session, with the trimrtc command in chronyc. Because of this, trimrtc will make sure that a meaningful RTC file is saved out after the change is completed).

The easiest protection against power failure is to put the dump and writertc commands in the same place as the offline command is issued to take chronyd offline; because chronyd free-runs between online sessions, no parameters will change significantly between going offline from the Internet and any power failure.

A final point regards home computers which are left running for extended periods and where it is desired to spin down the hard disc when it is not in use (e.g. when not accessed for 15 minutes). chronyd has been planned so it supports such operation; this is the reason why the RTC tracking parameters are not saved to disc after every update, but only when the user requests such a write, or during the shutdown sequence. The only other facility that will generate periodic writes to the disc is the log rtc facility in the configuration file; this option should not be used if you want your disc to spin down.


Previous: Dial-up overview, Up: Dial-up home PCs

3.4.2 Typical configuration files.

To illustrate how a dial-up home computer might be configured, example configuration files are shown in this section.

For the /etc/chrony.conf file, the following can be used as an example. NOTE : The server directives are only applicable to customers of Demon Internet; users of other ISPs will need to use their own ISP's NTP servers or public NTP servers.

     server 158.152.1.65 minpoll 5 maxpoll 10 maxdelay 0.4 offline
     server 158.152.1.76 minpoll 5 maxpoll 10 maxdelay 0.4 offline
     server 194.159.253.2 minpoll 5 maxpoll 10 maxdelay 0.4 offline
     logdir /var/log/chrony
     log statistics measurements tracking
     driftfile /etc/chrony.drift
     keyfile /etc/chrony.keys
     commandkey 25
     maxupdateskew 100.0
     dumponexit
     dumpdir /var/log/chrony
     rtcfile /etc/chrony.rtc

With Freeserve as the ISP, I use the following server lines :

     server 194.152.64.68 minpoll 5 maxpoll 10 maxdelay 0.4 offline
     server 194.152.64.35 minpoll 5 maxpoll 10 maxdelay 0.4 offline
     server 194.152.64.34 minpoll 5 maxpoll 10 maxdelay 0.4 offline

I use pppd for connecting to my ISP. This runs two scripts /etc/ppp/ip-up and /etc/ppp/ip-down when the link goes online and offline respectively.

The relevant part of the /etc/ppp/ip-up file is (with a dummy password)

     /usr/local/bin/chronyc <<EOF
     password xxxxxxxx
     online
     EOF

and the relevant part of the /etc/ppp/ip-down script is

     /usr/local/bin/chronyc <<EOF
     password xxxxxxxx
     offline
     dump
     writertc
     EOF

(Because they have to contain the administrator password, it would be desirable to make the files readable only by root on a multiuser machine).

To start chronyd during the boot sequence, I have the following in /etc/rc.d/rc.local (this is a Slackware system)

     if [ -f /usr/local/sbin/chronyd -a -f /etc/chrony.conf ]; then
       /usr/local/sbin/chronyd -r -s
       echo "Start chronyd"
     fi

The Debian package puts a script which handles this and shutdown in /etc/init.d/chrony.

The placement of this command may be important on some systems. In particular, chronyd may need to be started several seconds (about 10 as a minimum) before any software that depends on the system clock not jumping or moving backwards, depending on the directives in chronyd's configuration file.

For the system shutdown, chronyd should receive a SIGTERM several seconds before the final SIGKILL; the SIGTERM causes the measurement histories and RTC information to be saved out. There should be no need to add anything to the shutdown sequence, unless (as my system had) there is no pause between the SIGTERM and SIGKILL being delivered to the remaining processes. So if you find something like

     killall5 -15
     killall5 -9

in your /etc/rc.d/rc.0 script, you will need to insert a sleep, e.g.

     killall5 -15
     sleep 5
     killall5 -9

Otherwise, chronyd will not always save information on shutdown, which could be a problem if you don't use dump and writertc when you go offline.


Previous: Dial-up home PCs, Up: Typical scenarios

3.5 Other important configuration options

The most common option to include in the configuration file is the driftfile option. One of the major tasks of chronyd is to work out how fast or how slow the system clock runs relative to real time - e.g. in terms of seconds gained or lost per day. Measurements over a long period are usually required to refine this estimate to an acceptable degree of accuracy. Therefore, it would be bad if chronyd had to work the value out each time it is restarted, because the system clock would not run so accurately whilst the determination is taking place.

To avoid this problem, chronyd allows the gain or loss rate to be stored in a file, which can be read back in when the program is restarted. This file is called the drift file, and might typically be stored in /etc/chrony.drift. By specifying an option like the following

     driftfile /etc/chrony.drift

in the configuration file (/etc/chrony.conf), the drift file facility will be activated.


Next: , Previous: Typical scenarios, Up: Top

4 Usage reference


Next: , Up: Usage reference

4.1 Starting chronyd

If chronyd has been installed to its default location /usr/local/sbin/chronyd, starting it is simply a matter of entering the command

     /usr/local/sbin/chronyd

The Debian package uses /usr/sbin/chronyd.

Information messages and warnings will be logged to syslog.

The command line options supported are as follows:

-d
When run in this mode, the program will not detach itself from the terminal, and all messages will be sent to the terminal instead of to syslog.
-f <conf-file>
This option can be used to specify an alternate location for the configuration file (default /etc/chrony.conf).
-r
This option will reload sample histories for each of the servers being used. These histories are created by using the dump command in chronyc, or by setting the dumponexit directive in the configuration file. This option is useful if you want to stop and restart chronyd briefly for any reason, e.g. to install a new version. However, it only makes sense on systems where the kernel can maintain clock compensation whilst not under chronyd's control. The only version where this happens so far is Linux. On systems where this is not the case, e.g. Solaris and SunOS the option should not be used.
-s
This option will set the system clock from the computer's real-time clock. This is analogous to supplying the `-s' flag to the /sbin/clock program during the Linux boot sequence.

Support for real-time clocks is limited at present - the criteria are described in the section on the rtcfile directive (see rtcfile directive).

If chronyd cannot support the real time clock on your computer, this option cannot be used and a warning message will be logged to the syslog.

If used in conjunction with the `-r' flag, chronyd will attempt to preserve the old samples after setting the system clock from the real time clock. This can be used to allow chronyd to perform long term averaging of the gain or loss rate across system reboots, and is useful for dial-up systems that are shut down when not in use. For this to work well, it relies on chronyd having been able to determine accurate statistics for the difference between the real time clock and system clock last time the computer was on.

-v
This option displays chronyd's version number to the terminal and exits.

On systems that support an /etc/rc.local file for starting programs at boot time, chronyd can be started from there.

On systems with a System V style initialisation (e.g. Solaris), a suitable start/stop script might be as shown below. This might be placed in the file /etc/rc2.d/S83chrony.

     #!/bin/sh
     # This file should have uid root, gid sys and chmod 744
     #
     
     killproc() {            # kill the named process(es)
             pid=`/usr/bin/ps -e |
                  /usr/bin/grep -w $1 |
                  /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
             [ "$pid" != "" ] && kill $pid
     }
     
     case "$1" in
     
     'start')
        if [ -f /opt/free/sbin/chronyd -a -f /etc/chrony.conf ]; then
          /opt/free/sbin/chronyd
        fi
        ;;
     'stop')
        killproc chronyd
        ;;
     *)
        echo "Usage: /etc/rc2.d/S83chrony { start | stop }"
        ;;
     esac

(In both cases, you may want to bear in mind that chronyd can step the time when it starts. There may be other programs started at boot time that could be upset by this, so you may need to consider the ordering carefully. However, chronyd will need to start after daemons providing services that it may require, e.g. the domain name service.)


Next: , Previous: Starting chronyd, Up: Usage reference

4.2 The chronyd configuration file

The configuration file is normally called /etc/chrony.conf; in fact, this is the compiled-in default. However, other locations can be specified with a command line option.

Each command in the configuration file is placed on a separate line. The following sections describe each of the commands in turn. The directives can occur in any order in the file.


Next: , Up: Configuration file

4.2.1 Comments in the configuration file

The configuration file may contain comment lines. A comment line is any line that starts with zero or more spaces followed by any one of the following characters:

Any line with this format will be ignored.


Next: , Previous: comments in config file, Up: Configuration file

4.2.2 acquisitionport

chronyd uses a separate client-side port for the rapid-fire measurements requested with the initstepslew directive (see initstepslew directive). Normally, that port is chosen arbitrarily by the operating system. However, you can use acquisitionport to explicitly specify a port. This may be useful for getting through firewalls.

Do not make acquisition and regular NTP service (see port directive) use the same port.

An example of the acquisitionport command is

     acquisitionport 1123

This would change the port used for rapid queries to udp/1123. You could then persuade the firewall administrator to let that port through.


Next: , Previous: acquisitionport directive, Up: Configuration file

4.2.3 allow

The allow command is used to designate a particular subnet from which NTP clients are allowed to access the computer as an NTP server.

The default is that no clients are allowed access, i.e. chronyd operates purely as an NTP client. If the allow directive is used, chronyd will be both a client of its servers, and a server to other clients.

Examples of use of the command are as follows:

     allow foo.bar.com
     allow 1.2
     allow 3.4.5
     allow 6.7.8/22
     allow 6.7.8.9/22
     allow

The first command allows the named node to be an NTP client of this computer. The second command allows any node with an IP address of the form 1.2.x.y (with x and y arbitrary) to be an NTP client of this computer. Likewise, the third command allows any node with an IP address of the form 3.4.5.x to have client NTP access. The fourth and fifth forms allow access from any node with an IP address of the form 6.7.8.x, 6.7.9.x, 6.7.10.x or 6.7.11.x (with x arbitrary), i.e. the value 22 is the number of bits defining the specified subnet. (In the fifth form, the final byte is ignored). The sixth form allows access by any node on the entire Internet.

A second form of the directive, allow all, has a greater effect, depending on the ordering of directives in the configuration file. To illustrate the effect, consider the two examples

     allow 1.2.3.4
     deny 1.2.3
     allow 1.2

and

     allow 1.2.3.4
     deny 1.2.3
     allow all 1.2

In the first example, the effect is the same regardles of what order the three directives are given in. So the 1.2.x.y subnet is allowed access, except for the 1.2.3.x subnet, which is denied access, however the host 1.2.3.4 is allowed access.

In the second example, the allow all 1.2 directives overrides the effect of any previous directive relating to a subnet within the specified subnet. Within a configuration file this capability is probably rather moot; however, it is of greater use for reconfiguration at run-time via chronyc (see allow all command).

Note, if the initstepslew directive (see initstepslew directive) is used in the configuration file, each of the computers listed in that directive must allow client access by this computer for it to work.


Next: , Previous: allow directive, Up: Configuration file

4.2.4 bindaddress

The bindaddress allows you to restrict the network interface to which chronyd will listen for NTP packets. This provides an additional level of access restriction above that available through the 'deny' mechanism.

Suppose you have a local ethernet with addresses in the 192.168.1.0 subnet together with a dial-up connection. The ethernet interface's IP address is 192.168.1.1. Suppose (for some reason) you want to block all access through the dialup connection (note, this will even block replies from servers on the dialup side, so you will not be able to synchronise to an external source). You could add the line

     bindaddress 192.168.1.1

to the configuration file.

This directive affects NTP (UDP port 123) packets. If no bindcmdaddress directive is present, the address supplied by bindaddress will be used to control binding of the command socket (UDP port 323) as well.

The bindaddress directive has been found to cause problems when used on computers that need to pass NTP traffic over multiple network interfaces (e.g. firewalls). It is, therefore, not particularly useful. Use of the allow and deny directives together with a network firewall is more likely to be successful.


Next: , Previous: bindaddress directive, Up: Configuration file

4.2.5 bindcmdaddress

The bindcmdaddress allows you to restrict the network interface to which chronyd will listen for command packets (issued by chronyc).

Suppose you have a local ethernet with addresses in the 192.168.1.0 subnet together with a dial-up connection. The ethernet interface's IP address is 192.168.1.1. Suppose you want to block all access through the dialup connection. You could add the line

     bindcmdaddress 192.168.1.1

to the configuration file.

The bindcmdaddress directive has been found to cause problems when used on computers that need to pass command traffic over multiple network interfaces. It is, therefore, not particularly useful. Use of the cmdallow and cmddeny directives together with a network firewall is more likely to be successful.


Next: , Previous: bindcmdaddress directive, Up: Configuration file

4.2.6 broadcast

The broadcast directive is used to declare a broadcast address to which chronyd should send packets in NTP broadcast mode (i.e. make chronyd act as a broadcast server). Broadcast clients on that subnet will be able to synchronise.

The syntax is as follows

     broadcast 30 192.168.1.255
     broadcast 60 192.168.2.255 12123

In the first example, the destination port defaults to 123/udp (the normal NTP port). In the second example, the destionation port is specified as 12123. The first parameter in each case (30 or 60 respectively) is the interval in seconds between broadcast packets being sent. The second parameter in each case is the broadcast address to send the packet to. This should correspond to the broadcast address of one of the network interfaces on the computer where chronyd is running.

You can have more than 1 broadcast directive if you have more than 1 network interface onto which you wish to send NTP broadcast packets.

Chronyd itself cannot currently act as a broadcast client; it must always be configured as a point-to-point client by defining specific NTP servers and peers. This broadcast server feature is intended for providing a time source to other NTP software (e.g. various MS Windows clients).

If xntpd is used as the broadcast client, it will try to use a point-to-point client/server NTP access to measure the round-trip delay. Thus, the broadcast subnet should also be the subject of an allow directive (see allow directive).


Next: , Previous: broadcast directive, Up: Configuration file

4.2.7 cmdallow

This is similar to the allow directive (see allow directive), except that it allows control access (rather than NTP client access) to a particular subnet or host. (By 'control access' is meant that chronyc can be run on those hosts and successfully connect to chronyd on this computer.)

The syntax is identical to the allow directive.

There is also a cmdallow all directive with similar behaviour to the allow all directive (but applying to control access in this case, of course).


Next: , Previous: cmdallow directive, Up: Configuration file

4.2.8 cmddeny

This is similar to the cmdallow directive (see cmdallow directive), except that it denies control access to a particular subnet or host, rather than allowing it.

The syntax is identical.

There is also a cmddeny all directive with similar behaviour to the cmdallow all directive.


Next: , Previous: cmddeny directive, Up: Configuration file

4.2.9 commandkey

The commandkey command is used to set the key number used for authenticating user commands via the chronyc program at run time. This allows certain actions of the chronyc program to be restricted to administrators.

An example of the commandkey command is

     commandkey 20

In the key file (see the keyfile command) there should be a line of the form

     20 foobar

When running the chronyc program to perform run-time configuration, the command

     password foobar

must be entered before any commands affecting the operation of the daemon can be entered.


Next: , Previous: commandkey directive, Up: Configuration file

4.2.10 cmdport

The cmdport directive allows the port that is used for run-time command and monitoring (via the program chronyc) to be altered from its default (323/udp).

An example shows the syntax

     cmdport 257

This would make chronyd use 257/udp as its command port. (chronyc would need to be run with the -p 257 switch to inter-operate correctly).


Next: , Previous: cmdport directive, Up: Configuration file

4.2.11 deny

This is similar to the allow directive (see allow directive), except that it denies NTP client access to a particular subnet or host, rather than allowing it.

The syntax is identical.

There is also a deny all directive with similar behaviour to the allow all directive.


Next: , Previous: deny directive, Up: Configuration file

4.2.12 driftfile

One of the main activities of the chronyd program is to work out the rate at which the system clock gains or loses time relative to real time.

Whenever chronyd computes a new value of the gain/loss rate, it is desirable to record it somewhere. This allows chronyd to begin compensating the system clock at that rate whenever it is restarted, even before it has had a chance to obtain an equally good estimate of the rate during the new run. (This process may take many minutes, at least).

The driftfile command allows a file to be specified into which chronyd can store the rate information. Two parameters are recorded in the file. The first is the rate at which the system clock gains or loses time, expressed in parts per million, with gains positive. Therefore, a value of 100.0 indicates that when the system clock has advanced by a second, it has gained 100 microseconds on reality (so the true time has only advanced by 999900 microseconds). The second is an estimate of the error bound around the first value in which the true rate actually lies.

An example of the driftfile command is

     driftfile /etc/chrony.drift


Next: , Previous: driftfile directive, Up: Configuration file

4.2.13 dumpdir

To compute the rate of gain or loss of time, chronyd has to store a measurement history for each of the time sources it uses.

Certain systems (so far only Linux) have operating system support for setting the rate of gain or loss to compensate for known errors. (On other systems, chronyd must simulate such a capability by periodically slewing the system clock forwards or backwards by a suitable amount to compensate for the error built up since the previous slew).

For such systems, it is possible to save the measurement history across restarts of chronyd (assuming no changes are made to the system clock behaviour whilst it is not running). If this capability is to be used (via the dumponexit command in the configuration file, or the dump command in chronyc), the dumpdir command should be used to define the directory where the measurement histories are saved.

An example of the command is

     dumpdir /var/log/chrony

A source whose IP address is 1.2.3.4 would have its measurement history saved in the file /var/log/chrony/1.2.3.4.dat.


Next: , Previous: dumpdir directive, Up: Configuration file

4.2.14 dumponexit

If this command is present, it indicates that chronyd should save the measurement history for each of its time sources recorded whenever the program exits. (See the dumpdir command above).


Next: , Previous: dumponexit directive, Up: Configuration file

4.2.15 initstepslew

In normal operation, chronyd always slews the time when it needs to adjust the system clock. For example, to correct a system clock which is 1 second slow, chronyd slightly increases the amount by which the system clock is advanced on each clock interrupt, until the error is removed. (Actually, this is done by calling the adjtime() or similar system function which does it for us.) Note that at no time does time run backwards with this method.

On most Unix systems it is not desirable to step the system clock, because many programs rely on time advancing monotonically forwards.

When the chronyd daemon is initially started, it is possible that the system clock is considerably in error. Attempting to correct such an error by slewing may not be sensible, since it may take several hours to correct the error by this means.

The purpose of the initstepslew directive is to allow chronyd to make a rapid measurement of the system clock error at boot time, and to correct the system clock by stepping before normal operation begins. Since this would normally be performed only at an appropriate point in the system boot sequence, no other software should be adversely affected by the step.

If the correction required is less than a specified threshold, a slew is used instead. This makes it easier to restart chronyd whilst the system is in normal operation.

The initstepslew directive takes a threshold and a list of NTP servers as arguments. A maximum of 8 will be used. Each of the servers is rapidly polled several times, and a majority voting mechanism used to find the most likely range of system clock error that is present. A step (or slew) is applied to the system clock to correct this error. chronyd then enters its normal operating mode (where only slews are used).

An example of use of the command is

     initstepslew 30 foo.bar.com baz.quz.com

where 2 NTP servers are used to make the measurement. The 30 indicates that if the system's error is found to be 30 seconds or less, a slew will be used to correct it; if the error is above 30 seconds, a step will be used.

The initstepslew directive can also be used in an isolated LAN environment, where the clocks are set manually. The most stable computer is chosen as the master, and the other computers are slaved to it. If each of the slaves is configured with the local option (see below), the master can be set up with an initstepslew directive which references some or all of the slaves. Then, if the master machine has to be rebooted, the slaves can be relied on to 'flywheel' the time for the master.


Next: , Previous: initstepslew directive, Up: Configuration file

4.2.16 keyfile

This command is used to specify the location of the file containing ID/key pairs for the following 2 uses:

The format of the command is shown in the example below

     keyfile /etc/chrony.keys

The argument is simply the name of the file containing the ID/key pairs. The format of the file is shown below

     10 tulip
     11 hyacinth
     20 crocus
     25 iris
      ...

Each line consists of an ID and a password. The ID can be any unsigned integer in the range 0 through 2**32-1. The password can be any string of characters not containing a space.

For NTP use, the MD5 authentication scheme is always used. This must be borne in mind if chronyd is to inter-operate in authenticated mode with xntpd running on other computers.

The ID for the chronyc authentication key is specified with the commandkey command (see earlier).


Next: , Previous: linux_freq_scale directive, Up: Configuration file

4.2.17 local

The local keyword is used to allow chronyd to appear synchronised to real time (from the viewpoint of clients polling it), even if it has no current synchronisation source.

This option is normally used on computers in an isolated network, where several computers are required to synchronise to one other, this being the "master" which is kept vaguely in line with real time by manual input.

An example of the command is

     local stratum 10

The value 10 may be substituted with other values in the range 1 through 15. Stratum 1 indicates a computer that has a true real-time reference directly connected to it (e.g. GPS, atomic clock etc) &ndash; such computers are expected to be very close to real time. Stratum 2 computers are those which have a stratum 1 server; stratum 3 computers have a stratum 2 server and so on.

A large value of 10 indicates that the clock is so many hops away from a reference clock that its time is fairly unreliable. Put another way, if the computer ever has access to another computer which is ultimately synchronised to a reference clock, it will almost certainly be at a stratum less than 10. Therefore, the choice of a high value like 10 for the local command prevents the machine's own time from ever being confused with real time, were it ever to leak out to clients that have visibility of real servers.


Next: , Previous: keyfile directive, Up: Configuration file

4.2.18 linux_hz

(This option only applies to Linux).

By default, chronyd will find the value of HZ from a kernel header file at compile time. HZ is the nominal number of timer interrupts per second. If you're running chronyd on the system where it was built, the value it has should be right, and you don't need to worry about this option.

This option is provided for people who move a pre-built chronyd onto a system where the value of HZ in the kernel headers has been changed from the default value.

An example of the command is

     linux_hz 100


Next: , Previous: linux_hz directive, Up: Configuration file

4.2.19 linux_freq_scale

(This option only applies to Linux).

By default, chronyd will find the value of HZ and SHIFT_HZ from kernel header files at compile time. An internal value called freq_scale is calculated from this. By default it is (1<<SHIFT_HZ)/HZ, except for the case HZ=100, when special case code is used which leads to the value 128/128.125. If you're running chronyd on the system where it was built, the value it has should be right, and you don't need to worry about this option.

This option is provided for people who move a pre-built chronyd onto a system where the method by which the kernel computes the reciprocal of this value has been changed or where the HZ and SHIFT_HZ constants differ from those on the system where chronyd was built.

An example of the command is

     linux_freq_scale 0.99902439


Next: , Previous: local directive, Up: Configuration file

4.2.20 log

The log command indicates that certain information is to be logged.

measurements
This option logs the raw NTP measurements and related information to a file called measurements.log.
statistics
This option logs information about the regression processing to a file called statistics.log.
tracking
This option logs changes to the estimate of the system's gain or loss rate, and any slews made, to a file called tracking.log.
rtc
This option logs information about the system's real-time clock.

The files are written to the directory specified by the logdir command.

An example of the command is

     log measurements statistics tracking


Next: , Up: log directive
4.2.20.1 Measurements log file format

An example line (which actually appears as a single line in the file) from the measurements log file is shown below.

     1998-07-22 05:40:50 158.152.1.76    N  8 1111 11 1111 10 10  1 \
        -4.966e-03  2.296e-01  1.577e-05  1.615e-01  7.446e-03

The columns are as follows (the quantities in square brackets are the values from the example line above) :

  1. Date [1998-07-22]
  2. Hour:Minute:Second [05:40:50]. Note that the date/time pair is expressed in UTC, not the local time zone.
  3. IP address of server/peer from which measurement comes [158.152.1.76]
  4. Leap status (N means normal, - means that the last minute of today has 61 seconds, + means that the last minute of the day has 59 seconds, ? means the remote computer is not currently synchronised.) [N]
  5. Stratum of remote computer. [2]
  6. RFC1305 tests 1 through 4 (1=pass, 0=fail) [1111]
  7. Tests for maximum delay and maximum delay ratio, against user defined parameters (1=pass, 0=fail) [11]
  8. RFC1305 tests 5 through 8 (1=pass, 0=fail) [1111]
  9. Local poll [10]
  10. Remote poll [10]
  11. `Score' (an internal score within each polling level used to decide when to increase or decrease the polling level. This is adjusted based on changes to the variance of the measurements obtained from the source). [1]
  12. The estimated local clock error (`theta' in RFC1305). Positive indicates that the local clock is slow. [-4.966e-03].
  13. The peer delay (`delta' in RFC1305). [2.296e-01]
  14. The peer dispersion (`epsilon' in RFC1305). [1.577e-05]
  15. The root delay (`Delta' in RFC1305). [1.615e-01]
  16. The root dispersion (`E' in RFC1305). [7.446e-03]

A banner is periodically written to the log file to indicate the meanings of the columns.


Next: , Previous: measurements log, Up: log directive
4.2.20.2 Statistics log file format

An example line (which actually appears as a single line in the file) from the measurements log file is shown below.

     1998-07-22 05:40:50 158.152.1.76     6.261e-03 -3.247e-03 \
          2.220e-03  1.874e-06  1.080e-06 7.8e-02  16   0   8

The columns are as follows (the quantities in square brackets are the values from the example line above) :

  1. Date [1998-07-22]
  2. Hour:Minute:Second [05:40:50]. Note that the date/time pair is expressed in UTC, not the local time zone.
  3. IP address of server/peer from which measurement comes [158.152.1.76]
  4. The estimated standard deviation of the measurements from the source (in seconds). [6.261e-03]
  5. The estimated offset of the source (in seconds, positive means the local clock is estimated to be fast, in this case). [-3.247e-03]
  6. The estimated standard deviation of the offset estimate (in seconds). [2.220e-03]
  7. The estimated rate at which the local clock is gaining or losing time relative to the source (in seconds per second, positive means the local clock is gaining). This is relative to the compensation currently being applied to the local clock, not to the local clock without any compensation. [1.874e-06]
  8. The estimated error in the rate value (in seconds per second). [1.080e-06].
  9. The ration of |old_rate - new_rate| / old_rate_error. Large values indicate the statistics are not modelling the source very well. [7.8e-02]
  10. The number of measurements currently being used for the regression algorithm. [16]
  11. The new starting index (the oldest sample has index 0; this is the method used to prune old samples when it no longer looks like the measurements fit a linear model). [0, i.e. no samples discarded this time]
  12. The number of runs. The number of runs of regression residuals with the same sign is computed. If this is too small it indicates that the measurements are no longer represented well by a linear model and that some older samples need to be discarded. The number of runs for the data that is being retained is tabulated. Values of approximately half the number of samples are expected. [8]

A banner is periodically written to the log file to indicate the meanings of the columns.


Next: , Previous: statistics log, Up: log directive
4.2.20.3 Tracking log file format

An example line (which actually appears as a single line in the file) from the measurements log file is shown below.

     1998-07-22 05:40:50 158.152.1.76     3    340.529      1.606  1.046e-03

The columns are as follows (the quantities in square brackets are the values from the example line above) :

  1. Date [1998-07-22]
  2. Hour:Minute:Second [05:40:50]. Note that the date/time pair is expressed in UTC, not the local time zone.
  3. The IP address of the server/peer to which the local system is synchronised. [158.152.1.76]
  4. The stratum of the local system. [3]
  5. The local system frequency (in ppm, positive means the local system runs fast of UTC). [340.529]
  6. The error bounds on the frequency (in ppm) [1.606]
  7. The estimated local offset at the epoch (which is rapidly corrected by slewing the local clock. (In seconds, positive indicates the local system is fast of UTC). [1.046e-3]

A banner is periodically written to the log file to indicate the meanings of the columns.


Previous: tracking log, Up: log directive
4.2.20.4 Real-time clock log file format

An example line (which actually appears as a single line in the file) from the measurements log file is shown below.

     1998-07-22 05:40:50     -0.037360 1       -0.037434\
               -37.948  12   5  120

The columns are as follows (the quantities in square brackets are the values from the example line above) :

  1. Date [1998-07-22]
  2. Hour:Minute:Second [05:40:50]. Note that the date/time pair is expressed in UTC, not the local time zone.
  3. The measured offset between the system's real time clock and the system (gettimeofday()) time. In seconds, positive indicates that the RTC is fast of the system time. [-0.037360].
  4. Flag indicating whether the regression has produced valid coefficients. (1 for yes, 0 for no). [1]
  5. Offset at the current time predicted by the regression process. A large difference between this value and the measured offset tends to indicate that the measurement is an outlier with a serious measurement error. [-0.037434].
  6. The rate at which the RTC is losing or gaining time relative to the system clock. In ppm, with positive indicating that the RTC is gaining time. [-37.948]
  7. The number of measurements used in the regression. [12]
  8. The number of runs of regression residuals of the same sign. Low values indicate that a straight line is no longer a good model of the measured data and that older measurements should be discarded. [5]
  9. The measurement interval used prior to the measurement being made (in seconds). [120]

A banner is periodically written to the log file to indicate the meanings of the columns.


Next: , Previous: log directive, Up: Configuration file

4.2.21 logchange

This directive forces chronyd to send a message to syslog if it makes a system clock adjustment larger than a threshold value. An example of use is

     logchange 0.5

which would cause a syslog message to be generated a system clock error of over 0.5 seconds starts to be compensated.

Clock errors detected either via NTP packets or via timestamps entered via the settime command of chronyc are logged.

This directive assumes that syslog messages are appearing where somebody can see them. This allows that person to see if a large error has arisen, e.g. because of a fault, or because of faulty timezone handling, for example when summer time (daylight saving) starts or ends.


Next: , Previous: logchange directive, Up: Configuration file

4.2.22 logdir

This directive allows the directory where log files are written to be specified.

An example of the use of this directive is

     logdir /var/log/chrony


Next: , Previous: logdir directive, Up: Configuration file

4.2.23 mailonchange

This directive defines an email address to which mail should be sent if chronyd applies a correction exceeding a particular threshold to the system clock.

An example of use of this directive is

     mailonchange root@localhost 0.5

This would send a mail message to root if a change of more than 0.5 seconds were applied to the system clock.


Next: , Previous: mailonchange directive, Up: Configuration file

4.2.24 manual

The manual directive enables support at run-time for the settime command in chronyc (see settime command). If no manual directive is included, any attempt to use the settime command in chronyc will be met with an error message.

Note that the settime command can be enabled at run-time using the manual command in chronyc (see manual command). (The idea of the two commands is that the manual command controls the manual clock driver's behaviour, whereas the settime command allows samples of manually entered time to be provided).


Next: , Previous: manual directive, Up: Configuration file

4.2.25 maxupdateskew

One of chronyd's tasks is to work out how fast or slow the computer's clock runs relative to its reference sources. In addition, it computes an estimate of the error bounds around the estimated value.

If the range of error is too large, it probably indicates that the measurements have not settled down yet, and that the estimated gain or loss rate is not very reliable.

The maxupdateskew parameter allows the threshold for determining whether an estimate may be so unreliable that it should not be used.

The syntax is

     maxupdateskew <skew-in-ppm>

Typical values for <skew-in-ppm> might be 100 for a dial-up connection to servers over a phone line, and 5 or 10 for a computer on a LAN.

It should be noted that this is not the only means of protection against using unreliable estimates. At all times, chronyd keeps track of both the estimated gain or loss rate, and the error bound on the estimate. When a new estimate is generated following another measurement from one of the sources, a weighted combination algorithm is used to update the master estimate. So if chronyd has an existing highly-reliable master estimate and a new estimate is generated which has large error bounds, the existing master estimate will dominate in the new master estimate.


Next: , Previous: maxupdateskew directive, Up: Configuration file

4.2.26 noclientlog

This directive, which takes no arguments, specifies that client accesses are not to be logged. Normally they are logged, allowing statistics to be reported using the clients command in chronyc.


Next: , Previous: noclientlog directive, Up: Configuration file

4.2.27 peer

The syntax of this directive is identical to that for the server directive (see server directive), except that it is used to specify an NTP peer rather than an NTP server.


Next: , Previous: peer directive, Up: Configuration file

4.2.28 pidfile

chronyd always writes its process ID (pid) to a file, and checks this file on startup to see if another chronyd may already be running on the system. By default, the file used is /var/run/chronyd.pid. The pidfile directive allows the name to be changed, e.g.

     pidfile /var/tmp/chronyd.pid


Next: , Previous: pidfile directive, Up: Configuration file

4.2.29 port

This option allows you to configure the port used for the NTP service on your machine.

The compiled in default is udp/123, the standard NTP port. It is unlikely that you would ever need to change this value. A possible exception would be if you wanted to operate strictly in client-only mode and never be available as a server to xntpd clients.

An example of the port command is

     port 11123

This would change the NTP port served by chronyd on the computer to udp/11123.


Next: , Previous: port directive, Up: Configuration file

4.2.30 rtcdevice

The rtcdevice directive defines the name of the device file for accessing the real time clock. By default this is /dev/rtc/, unless the directive is used to set a different value. This applies to Linux systems with devfs. An example of use is

     rtcdevice /dev/misc/rtc


Next: , Previous: rtcdevice directive, Up: Configuration file

4.2.31 rtcfile

The rtcfile directive defines the name of the file in which chronyd can save parameters associated with tracking the accuracy of the system's real-time clock (RTC).

The syntax is illustrated in the following example

     rtcfile /etc/chrony.rtc

chronyd saves information in this file when it exits and when the writertc command is issued in chronyc. The information saved is the RTC's error at some epoch, that epoch (in seconds since January 1 1970), and the rate at which the RTC gains or loses time.

So far, the support for real-time clocks is limited - their code is even more system-specific than the rest of the software. You can only use the real time clock facilities (the rtcfile directive and the -s command line option to chronyd) if the following three conditions apply:

  1. You are running Linux version 2.2.x or 2.4.x (for any value of x), or v2.0.x with x>=32.
  2. You have compiled the kernel with extended real-time clock support (i.e. the /dev/rtc device is capable of doing useful things).
  3. You don't have other applications that need to make use of /dev/rtc at all.


Next: , Previous: rtcfile directive, Up: Configuration file

4.2.32 rtconutc

chronyd assumes by default that the real time clock (RTC) keeps local time (including any daylight saving changes). This is convenient on PCs running Linux which are dual-booted with DOS or Windows.

NOTE : IF YOU KEEP THE REAL TIME CLOCK ON LOCAL TIME AND YOUR COMPUTER IS OFF WHEN DAYLIGHT SAVING (SUMMER TIME) STARTS OR ENDS, THE COMPUTER'S SYSTEM TIME WILL BE ONE HOUR IN ERROR WHEN YOU NEXT BOOT AND START CHRONYD.

An alternative is for the RTC to keep Universal Coordinated Time (UTC). This does not suffer from the 1 hour problem when daylight saving starts or ends.

If the rtconutc directive appears, it means the RTC is required to keep UTC. The directive takes no arguments. It is equivalent to specifying the -u switch to the Linux /sbin/clock program.


Previous: rtconutc directive, Up: Configuration file

4.2.33 server

The server directive allows NTP servers to be specified. The client/server relationship is strictly hierarchical : a client may synchronise its system time to that of the server, but the server's system time will never be influenced by that of a client.

The server directive is immediately followed by either the name of the server, or its IP address in dotted-quad notation. The server command also supports a number of subfields (which may be defined in any order):

port
This option allows the UDP port on which the server understands NTP requests to be specified. For normal servers this option should not be required (the default is 123, the standard NTP port).
minpoll
Although chronyd will trim the rate at which it samples the server during normal operation, the user may wish to constrain the minimum polling interval. This is always defined as a power of 2, so <tt/minpoll 5/ would mean that the polling interval cannot drop below 32 seconds. The default is 6 (64 seconds).
maxpoll
In a similar way, the user may wish to constrain the maximum polling interval. Again this is specified as a power of 2, so <tt/maxpoll 9/ indicates that the polling interval must stay at or below 512 seconds. The default is 10 (1024 seconds).
maxdelay
chronyd uses the network round-trip delay to the server to determine how accurate a particular measurement is likely to be. Long round-trip delays indicate that the request, or the response, or both were delayed. If only one of the messages was delayed the measurement error is likely to be substantial.

For small variations in round trip delay, chronyd uses a weighting scheme when processing the measurements. However, beyond a certain level of delay the measurements are likely to be so corrupted as to be useless. (This is particularly so on dial-up or other slow links, where a long delay probably indicates a highly asymmetric delay caused by the response waiting behind a lot of packets related to a download of some sort).

If the user knows that round trip delays above a certain level should cause the measurement to be ignored, this level can be defined with the maxdelay command. For example, <tt/maxdelay 0.3/ would indicate that measurements with a round-trip delay of 0.3 seconds or more should be ignored.

maxdelayratio
This option is similar to the maxdelay option above. chronyd keeps a record of the minimum round-trip delay amongst the previous measurements that it has buffered. If a measurement has a round trip delay that is greater than the maxdelayratio times the minimum delay, it will be rejected.
presend
If the timing measurements being made by chronyd are the only network data passing between two computers, you may find that some measurements are badly skewed due to either the client or the server having to do an ARP lookup on the other party prior to transmitting a packet. This is more of a problem with long sampling intervals, which may be similar in duration to the lifetime of entries in the ARP caches of the machines.

In order to avoid this problem, the presend option may be used. It takes a single integer argument, which is the smallest polling interval for which a pair of packets will be exchanged between the client and the server prior to the actual measurement being initiated by the client. For example, with the following option included in a server directive :

          presend 9
     

when the polling interval is 512 seconds or more, a UDP echo datagram will be sent to the server a short time (currently 4 seconds) before the NTP client mode datagram.

key
The NTP protocol supports the inclusion of checksums in the packets, to prevent computers having their system time upset by rogue packets being sent to them. The checksums are generated as a function of a password, using the MD5 algorithm.

The association between key numbers and passwords is contained in the keys file, defined by the keyfile command.

If the key option is present, chronyd will attempt to use authenticated packets when communicating with this server. The key number used will be the single argument to the key option. The server must have the same password for this key number configured, otherwise no relationship between the computers will be possible.

offline
If the server will not be reachable when chronyd is started, the offline option may be specified. chronyd will not try to poll the server until it is enabled to do so (by using the online option of chronyc).
auto_offline
If this option is set, the server will be assumed to have gone offline when 2 requests have been sent to it without receiving a response. This option avoids the need to run the offline (see offline command) command from chrony when disconnecting the dial-up link. (It will still be necessary to use chronyc's online (see online command) command when the link has been established, to enable measurements to start.)


Previous: Configuration file, Up: Usage reference

4.3 Running chronyc

Chronyc is the program that can be used to reconfigure options within the chronyd program whilst it is running. Chronyc can also be used to generate status reports about the operation of chronyd.


Next: , Up: Running chronyc

4.3.1 Basic use

The program chronyc is run by entering

     chronyc

at the command line. The prompt chronyc is displayed whilst chronyc is expecting input from the user, when it is being run from a terminal. If chronyc's input or output are redirected from/to a file, the prompt is now shown.

When you are finished entering commands, the commands exit or quit will terminate the program. (Entering <Control-D> will also terminate the program.)


Next: , Previous: Chronyc basic use, Up: Running chronyc

4.3.2 Command line options

Chronyc supports the following command line options.

-v
Displays the version number of chronyc on the terminal, and exists.
-h <host>
This option allows the user to specify which host running the chronyd program is to be contacted. This allows for remote configuration, without having to telnet or rlogin to the other host first.

The default is to contact chronyd running on the same host as that where chronyc is being run.

-p <port>
This option allows the user to specify the UDP port number which the target chronyd is using for its command & monitoring connections. This defaults to the compiled-in default; there would rarely be a need to change this.


Next: , Previous: Chronyc command line options, Up: Running chronyc

4.3.3 Security with chronyc

Many of the commands available through chronyc have a fair amount of power to reconfigure the run-time behaviour of chronyd. Consequently, chronyc is quite dangerous for the integrity of the target system's clock performance. Having access to chronyd via chronyc is more or less equivalent to being able to modify chronyd's configuration file (typically /etc/chrony.conf) and to restart chronyd.

Chronyc also provides a number of monitoring (as opposed to commanding) commands, which will not affect the behaviour of chronyd. However, you may still want to restrict access to these commands.

In view of this, access to some of the capabilities of chronyc will usually be tightly controlled. There are two mechanisms supported:

  1. The set of hosts from which chronyd will accept commands can be restricted. By default, commands will only be accepted from the same host that chronyd is running on.
  2. Any command that actually reconfigures some aspect of chronyd's behaviour requires the user of chronyc to know a password. This password is specified in chronyd's keys file (see keyfile directive) and specified via the commandkey option in its configuration file (see commandkey directive).

Only the following commands can be used without providing a password:

All other commands require a password to have been specified previously, because they affect chronyd's operation.


Previous: Security with chronyc, Up: Running chronyc

4.3.4 Command reference

This section describes each of the commands available within the chronyc program. Chronyc offers the user a simple command-line driven interface.


Next: , Up: Chronyc command reference
4.3.4.1 accheck

This command allows you to check whether client NTP access is allowed from a particular host.

Examples of use, showing a named host and a numeric IP address, are as follows:

     accheck a.b.c
     accheck 1.2.3.4

This command can be used to examine the effect of a series of allow, allow all, deny and deny all commands specified either via chronyc, or in chronyd's configuration file.


Next: , Previous: accheck command, Up: Chronyc command reference
4.3.4.2 activity

This command reports the number of servers/peers that are online and offline. If the auto_offline option is used in specifying some of the servers/peers, the activity command may be useful for detecting when all of them have entered the offline state after the PPP link has been disconnected.

The report shows the number of servers/peers in 4 states:


Next: , Previous: activity command, Up: Chronyc command reference
4.3.4.3 add peer

The add peer command allows a new NTP peer to be added whilst chronyd is running.

Following the words add peer, the syntax of the following parameters and options is identical to that for the peer directive in the configuration file (see peer directive).

An example of using this command is shown below.

     add peer foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add peer command, Up: Chronyc command reference
4.3.4.4 add server

The add server command allows a new NTP server to be added whilst chronyd is running.

Following the words add server, the syntax of the following parameters and options is identical to that for the server directive in the configuration file (see server directive).

An example of using this command is shown below.

     add server foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add server command, Up: Chronyc command reference
4.3.4.5 allow

The effect of the allow command is identical to the allow directive in the configuration file (see allow directive).

The syntax is illustrated in the following examples:

     allow foo.bar.com
     allow 1.2
     allow 3.4.5
     allow 6.7.8/22
     allow 6.7.8.9/22
     allow

The effect of each of these examples is the same as that of the allow directive in the configuration file.


Next: , Previous: allow command, Up: Chronyc command reference
4.3.4.6 allow all

The effect of the allow command is identical to the allow all directive in the configuration file (see allow directive).


Next: , Previous: allow all command, Up: Chronyc command reference
4.3.4.7 burst

The burst command tells chronyd to make a set of measurements to each of its sources over a short duration (rather than the usual periodic measurements that it makes). After such a burst, chronyd will revert to the previous state for each source. This might be either online, if the source was being periodically measured in the normal way, or offline, if the source had been indicated as being offline. (Switching a source between the online and offline states is described in online command, offline command).

The syntax of the burst command is as follows

     burst <n-good-measurements>/<max-measurements> [<mask>/<masked-address>]

The mask and masked-address arguments are optional, in which case chronyd will initiate a burst for all of its currently defined sources.

The arguments have the following meaning and format.

n-good-measurements
This defines the number of good measurements that chronyd will want to obtain from each source. A measurement is good if it passes certain tests, for example, the round trip time to the source must be acceptable. (This allows chronyd to reject measurements that are likely to be bogus.)
max-measurements
This defines the maximum number of measurements that chronyd will attempt to make, even if the required number of good measurements has not been obtained.
mask
This is a dotted quad argument (e.g. 255.255.255.0) with which the IP address of each of chronyd's sources is to be masked.
masked-address
This is a dotted quad argument (e.g. 1.2.3.0). If the masked IP address of a source matches this value then the burst command is applied to that source.

If no mask or masked address arguments are provided, the default is 0.0.0.0 and 0.0.0.0 respectively, which will match every source.

An example of the two-argument form of the command is

     burst 2/10

This will cause chronyd to attempt to get two good measurements from each source, stopping after two have been obtained, but in no event will it try more than ten probes to the source.

An example of the four-argument form of the command is

     burst 2/10 255.255.0.0/1.2.0.0

In this case, the two out of ten sampling will only be applied to sources whose IP addresses are of the form 1.2.x.y, where x and y are arbitrary.


Next: , Previous: burst command, Up: Chronyc command reference
4.3.4.8 clients

This command shows a list of all clients that have accessed the server, through either the NTP or command/monitoring ports. There are no arguments.

An example of the output is

     Hostname                   Client    Peer CmdAuth CmdNorm  CmdBad  LstN  LstC
     =========================  ======  ======  ======  ======  ======  ====  ====
     localhost                       0       0      15       1       0   29y     0
     aardvark.xxx                    4       0       0       0       0    49   29y
     badger.xxx                      4       0       0       0       0     6   29y

Each row shows the data for a single host. Only hosts that have passed the host access checks (set with the allow, deny, cmdallow and cmddeny commands or configuration file directives) are logged.

The columns are as follows:

  1. The hostname of the client
  2. The number of times the client has accessed the server using an NTP client mode packet.
  3. The number of times the client has accessed the server using an NTP symmetric active mode packet.
  4. The number of authenticated command packets that have been processed from the client (i.e. those following a successful password command).
  5. The number of unauthenticated command packets that have been processed from the client.
  6. The number of bad command packets received from the client (not all forms of bad packet are logged).
  7. Time since the last NTP packet was received
  8. Time since the last command packet was received

The last two entries will be shown as the time since 1970 if no packet of that type has ever been received.


Next: , Previous: clients command, Up: Chronyc command reference
4.3.4.9 cmdaccheck

This command is similar to the accheck command, except that it is used to check whether command access is permitted from a named host.

Examples of use are as follows:

     cmdaccheck a.b.c
     cmdaccheck 1.2.3.4


Next: , Previous: cmdaccheck command, Up: Chronyc command reference
4.3.4.10 cmdallow

This is similar to the allow command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow command, Up: Chronyc command reference
4.3.4.11 cmdallow all

This is similar to the allow all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow all command, Up: Chronyc command reference
4.3.4.12 cmddeny

This is similar to the deny command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny command, Up: Chronyc command reference
4.3.4.13 cmddeny all

This is similar to the deny all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny all command, Up: Chronyc command reference
4.3.4.14 cyclelogs

The cyclelogs command causes all of chronyd's open log files to be closed and re-opened. This allows them to be renamed so that they can be periodically purged. An example of how to do this is shown below.

     % mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
     % chronyc
     chronyc> password aardvark
     200 OK
     chronyc> cyclelogs
     200 OK
     chronyc> exit
     % ls -l /var/log/chrony
     -rw-r--r--   1 root     root            0 Jun  8 18:17 measurements.log
     -rw-r--r--   1 root     root        12345 Jun  8 18:17 measurements1.log
     % rm -f measurements1.log


Next: , Previous: cyclelogs command, Up: Chronyc command reference
4.3.4.15 delete

The delete command allows an NTP server or peer to be removed from the current set of sources.

The syntax is illustrated in the examples below.

     delete foo.bar.com
     delete 1.2.3.4

There is one parameter, the name or IP address of the server or peer to be deleted.


Next: , Previous: delete command, Up: Chronyc command reference
4.3.4.16 deny

The effect of the allow command is identical to the deny directive in the configuration file (see deny directive).

The syntax is illustrated in the following examples:

     deny foo.bar.com
     deny 1.2
     deny 3.4.5
     deny 6.7.8/22
     deny 6.7.8.9/22
     deny


Next: , Previous: deny command, Up: Chronyc command reference
4.3.4.17 deny all

The effect of the allow command is identical to the deny all directive in the configuration file (see deny directive).


Next: , Previous: deny all command, Up: Chronyc command reference
4.3.4.18 dump

The dump command causes chronyd to write its current history of measurements for each of its sources to dump files, either for inspection or to support the -r option when chronyd is restarted.

The dump command is somewhat equivalent to the dumponexit directive in the chrony configuration file. See dumponexit directive.

To use the dump, you probably want to configure the name of the directory into which the dump files will be written. This can only be done in the configuration file, see dumpdir directive.


Next: , Previous: dump command, Up: Chronyc command reference
4.3.4.19 exit

The et history o>chronyd is running.

Following the words add peer, the syntax of the following parameters and options is identical to that for the peer directive in the configuration file (see peer directive).

An example of using this command is shown below.

     add peer foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add peer command, Up: Chronyc command reference
4.3.4.4 add server

The add server command allows a new NTP server to be added whilst chronyd is running.

Following the words add server, the syntax of the following parameters and options is identical to that for the server directive in the configuration file (see server directive).

An example of using this command is shown below.

     add server foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add server command, Up: Chronyc command reference
4.3.4.5 allow

The effect of the allow command is identical to the allow directive in the configuration file (see allow directive).

The syntax is illustrated in the following examples:

     allow foo.bar.com
     allow 1.2
     allow 3.4.5
     allow 6.7.8/22
     allow 6.7.8.9/22
     allow

The effect of each of these examples is the same as that of the allow directive in the configuration file.


Next: , Previous: allow command, Up: Chronyc command reference
4.3.4.6 allow all

The effect of the allow command is identical to the allow all directive in the configuration file (see allow directive).


Next: , Previous: allow all command, Up: Chronyc command reference
4.3.4.7 burst

The burst command tells chronyd to make a set of measurements to each of its sources over a short duration (rather than the usual periodic measurements that it makes). After such a burst, chronyd will revert to the previous state for each source. This might be either online, if the source was being periodically measured in the normal way, or offline, if the source had been indicated as being offline. (Switching a source between the online and offline states is described in online command, offline command).

The syntax of the burst command is as follows

     burst <n-good-measurements>/<max-measurements> [<mask>/<masked-address>]

The mask and masked-address arguments are optional, in which case chronyd will initiate a burst for all of its currently defined sources.

The arguments have the following meaning and format.

n-good-measurements
This defines the number of good measurements that chronyd will want to obtain from each source. A measurement is good if it passes certain tests, for example, the round trip time to the source must be acceptable. (This allows chronyd to reject measurements that are likely to be bogus.)
max-measurements
This defines the maximum number of measurements that chronyd will attempt to make, even if the required number of good measurements has not been obtained.
mask
This is a dotted quad argument (e.g. 255.255.255.0) with which the IP address of each of chronyd's sources is to be masked.
masked-address
This is a dotted quad argument (e.g. 1.2.3.0). If the masked IP address of a source matches this value then the burst command is applied to that source.

If no mask or masked address arguments are provided, the default is 0.0.0.0 and 0.0.0.0 respectively, which will match every source.

An example of the two-argument form of the command is

     burst 2/10

This will cause chronyd to attempt to get two good measurements from each source, stopping after two have been obtained, but in no event will it try more than ten probes to the source.

An example of the four-argument form of the command is

     burst 2/10 255.255.0.0/1.2.0.0

In this case, the two out of ten sampling will only be applied to sources whose IP addresses are of the form 1.2.x.y, where x and y are arbitrary.


Next: , Previous: burst command, Up: Chronyc command reference
4.3.4.8 clients

This command shows a list of all clients that have accessed the server, through either the NTP or command/monitoring ports. There are no arguments.

An example of the output is

     Hostname                   Client    Peer CmdAuth CmdNorm  CmdBad  LstN  LstC
     =========================  ======  ======  ======  ======  ======  ====  ====
     localhost                       0       0      15       1       0   29y     0
     aardvark.xxx                    4       0       0       0       0    49   29y
     badger.xxx                      4       0       0       0       0     6   29y

Each row shows the data for a single host. Only hosts that have passed the host access checks (set with the allow, deny, cmdallow and cmddeny commands or configuration file directives) are logged.

The columns are as follows:

  1. The hostname of the client
  2. The number of times the client has accessed the server using an NTP client mode packet.
  3. The number of times the client has accessed the server using an NTP symmetric active mode packet.
  4. The number of authenticated command packets that have been processed from the client (i.e. those following a successful password command).
  5. The number of unauthenticated command packets that have been processed from the client.
  6. The number of bad command packets received from the client (not all forms of bad packet are logged).
  7. Time since the last NTP packet was received
  8. Time since the last command packet was received

The last two entries will be shown as the time since 1970 if no packet of that type has ever been received.


Next: , Previous: clients command, Up: Chronyc command reference
4.3.4.9 cmdaccheck

This command is similar to the accheck command, except that it is used to check whether command access is permitted from a named host.

Examples of use are as follows:

     cmdaccheck a.b.c
     cmdaccheck 1.2.3.4


Next: , Previous: cmdaccheck command, Up: Chronyc command reference
4.3.4.10 cmdallow

This is similar to the allow command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow command, Up: Chronyc command reference
4.3.4.11 cmdallow all

This is similar to the allow all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow all command, Up: Chronyc command reference
4.3.4.12 cmddeny

This is similar to the deny command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny command, Up: Chronyc command reference
4.3.4.13 cmddeny all

This is similar to the deny all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny all command, Up: Chronyc command reference
4.3.4.14 cyclelogs

The cyclelogs command causes all of chronyd's open log files to be closed and re-opened. This allows them to be renamed so that they can be periodically purged. An example of how to do this is shown below.

     % mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
     % chronyc
     chronyc> password aardvark
     200 OK
     chronyc> cyclelogs
     200 OK
     chronyc> exit
     % ls -l /var/log/chrony
     -rw-r--r--   1 root     root            0 Jun  8 18:17 measurements.log
     -rw-r--r--   1 root     root        12345 Jun  8 18:17 measurements1.log
     % rm -f measurements1.log


Next: , Previous: cyclelogs command, Up: Chronyc command reference
4.3.4.15 delete

The delete command allows an NTP server or peer to be removed from the current set of sources.

The syntax is illustrated in the examples below.

     delete foo.bar.com
     delete 1.2.3.4

There is one parameter, the name or IP address of the server or peer to be deleted.


Next: , Previous: delete command, Up: Chronyc command reference
4.3.4.16 deny

The effect of the allow command is identical to the deny directive in the configuration file (see deny directive).

The syntax is illustrated in the following examples:

     deny foo.bar.com
     deny 1.2
     deny 3.4.5
     deny 6.7.8/22
     deny 6.7.8.9/22
     deny


Next: , Previous: deny command, Up: Chronyc command reference
4.3.4.17 deny all

The effect of the allow command is identical to the deny all directive in the configuration file (see deny directive).


Next: , Previous: deny all command, Up: Chronyc command reference
4.3.4.18 dump

The dump command causes chronyd to write its current history of measurements for each of its sources to dump files, either for inspection or to support the -r option when chronyd is restarted.

The dump command is somewhat equivalent to the dumponexit directive in the chrony configuration file. See dumponexit directive.

To use the dump, you probably want to configure the name of the directory into which the dump files will be written. This can only be done in the configuration file, see dumpdir directive.


Next: , Previous: dump command, Up: Chronyc command reference
4.3.4.19 exit

The et history o>chronyd is running.

Following the words add peer, the syntax of the following parameters and options is identical to that for the peer directive in the configuration file (see peer directive).

An example of using this command is shown below.

     add peer foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add peer command, Up: Chronyc command reference
4.3.4.4 add server

The add server command allows a new NTP server to be added whilst chronyd is running.

Following the words add server, the syntax of the following parameters and options is identical to that for the server directive in the configuration file (see server directive).

An example of using this command is shown below.

     add server foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add server command, Up: Chronyc command reference
4.3.4.5 allow

The effect of the allow command is identical to the allow directive in the configuration file (see allow directive).

The syntax is illustrated in the following examples:

     allow foo.bar.com
     allow 1.2
     allow 3.4.5
     allow 6.7.8/22
     allow 6.7.8.9/22
     allow

The effect of each of these examples is the same as that of the allow directive in the configuration file.


Next: , Previous: allow command, Up: Chronyc command reference
4.3.4.6 allow all

The effect of the allow command is identical to the allow all directive in the configuration file (see allow directive).


Next: , Previous: allow all command, Up: Chronyc command reference
4.3.4.7 burst

The burst command tells chronyd to make a set of measurements to each of its sources over a short duration (rather than the usual periodic measurements that it makes). After such a burst, chronyd will revert to the previous state for each source. This might be either online, if the source was being periodically measured in the normal way, or offline, if the source had been indicated as being offline. (Switching a source between the online and offline states is described in online command, offline command).

The syntax of the burst command is as follows

     burst <n-good-measurements>/<max-measurements> [<mask>/<masked-address>]

The mask and masked-address arguments are optional, in which case chronyd will initiate a burst for all of its currently defined sources.

The arguments have the following meaning and format.

n-good-measurements
This defines the number of good measurements that chronyd will want to obtain from each source. A measurement is good if it passes certain tests, for example, the round trip time to the source must be acceptable. (This allows chronyd to reject measurements that are likely to be bogus.)
max-measurements
This defines the maximum number of measurements that chronyd will attempt to make, even if the required number of good measurements has not been obtained.
mask
This is a dotted quad argument (e.g. 255.255.255.0) with which the IP address of each of chronyd's sources is to be masked.
masked-address
This is a dotted quad argument (e.g. 1.2.3.0). If the masked IP address of a source matches this value then the burst command is applied to that source.

If no mask or masked address arguments are provided, the default is 0.0.0.0 and 0.0.0.0 respectively, which will match every source.

An example of the two-argument form of the command is

     burst 2/10

This will cause chronyd to attempt to get two good measurements from each source, stopping after two have been obtained, but in no event will it try more than ten probes to the source.

An example of the four-argument form of the command is

     burst 2/10 255.255.0.0/1.2.0.0

In this case, the two out of ten sampling will only be applied to sources whose IP addresses are of the form 1.2.x.y, where x and y are arbitrary.


Next: , Previous: burst command, Up: Chronyc command reference
4.3.4.8 clients

This command shows a list of all clients that have accessed the server, through either the NTP or command/monitoring ports. There are no arguments.

An example of the output is

     Hostname                   Client    Peer CmdAuth CmdNorm  CmdBad  LstN  LstC
     =========================  ======  ======  ======  ======  ======  ====  ====
     localhost                       0       0      15       1       0   29y     0
     aardvark.xxx                    4       0       0       0       0    49   29y
     badger.xxx                      4       0       0       0       0     6   29y

Each row shows the data for a single host. Only hosts that have passed the host access checks (set with the allow, deny, cmdallow and cmddeny commands or configuration file directives) are logged.

The columns are as follows:

  1. The hostname of the client
  2. The number of times the client has accessed the server using an NTP client mode packet.
  3. The number of times the client has accessed the server using an NTP symmetric active mode packet.
  4. The number of authenticated command packets that have been processed from the client (i.e. those following a successful password command).
  5. The number of unauthenticated command packets that have been processed from the client.
  6. The number of bad command packets received from the client (not all forms of bad packet are logged).
  7. Time since the last NTP packet was received
  8. Time since the last command packet was received

The last two entries will be shown as the time since 1970 if no packet of that type has ever been received.


Next: , Previous: clients command, Up: Chronyc command reference
4.3.4.9 cmdaccheck

This command is similar to the accheck command, except that it is used to check whether command access is permitted from a named host.

Examples of use are as follows:

     cmdaccheck a.b.c
     cmdaccheck 1.2.3.4


Next: , Previous: cmdaccheck command, Up: Chronyc command reference
4.3.4.10 cmdallow

This is similar to the allow command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow command, Up: Chronyc command reference
4.3.4.11 cmdallow all

This is similar to the allow all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow all command, Up: Chronyc command reference
4.3.4.12 cmddeny

This is similar to the deny command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny command, Up: Chronyc command reference
4.3.4.13 cmddeny all

This is similar to the deny all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny all command, Up: Chronyc command reference
4.3.4.14 cyclelogs

The cyclelogs command causes all of chronyd's open log files to be closed and re-opened. This allows them to be renamed so that they can be periodically purged. An example of how to do this is shown below.

     % mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
     % chronyc
     chronyc> password aardvark
     200 OK
     chronyc> cyclelogs
     200 OK
     chronyc> exit
     % ls -l /var/log/chrony
     -rw-r--r--   1 root     root            0 Jun  8 18:17 measurements.log
     -rw-r--r--   1 root     root        12345 Jun  8 18:17 measurements1.log
     % rm -f measurements1.log


Next: , Previous: cyclelogs command, Up: Chronyc command reference
4.3.4.15 delete

The delete command allows an NTP server or peer to be removed from the current set of sources.

The syntax is illustrated in the examples below.

     delete foo.bar.com
     delete 1.2.3.4

There is one parameter, the name or IP address of the server or peer to be deleted.


Next: , Previous: delete command, Up: Chronyc command reference
4.3.4.16 deny

The effect of the allow command is identical to the deny directive in the configuration file (see deny directive).

The syntax is illustrated in the following examples:

     deny foo.bar.com
     deny 1.2
     deny 3.4.5
     deny 6.7.8/22
     deny 6.7.8.9/22
     deny


Next: , Previous: deny command, Up: Chronyc command reference
4.3.4.17 deny all

The effect of the allow command is identical to the deny all directive in the configuration file (see deny directive).


Next: , Previous: deny all command, Up: Chronyc command reference
4.3.4.18 dump

The dump command causes chronyd to write its current history of measurements for each of its sources to dump files, either for inspection or to support the -r option when chronyd is restarted.

The dump command is somewhat equivalent to the dumponexit directive in the chrony configuration file. See dumponexit directive.

To use the dump, you probably want to configure the name of the directory into which the dump files will be written. This can only be done in the configuration file, see dumpdir directive.


Next: , Previous: dump command, Up: Chronyc command reference
4.3.4.19 exit

The et history o>chronyd is running.

Following the words add peer, the syntax of the following parameters and options is identical to that for the peer directive in the configuration file (see peer directive).

An example of using this command is shown below.

     add peer foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add peer command, Up: Chronyc command reference
4.3.4.4 add server

The add server command allows a new NTP server to be added whilst chronyd is running.

Following the words add server, the syntax of the following parameters and options is identical to that for the server directive in the configuration file (see server directive).

An example of using this command is shown below.

     add server foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add server command, Up: Chronyc command reference
4.3.4.5 allow

The effect of the allow command is identical to the allow directive in the configuration file (see allow directive).

The syntax is illustrated in the following examples:

     allow foo.bar.com
     allow 1.2
     allow 3.4.5
     allow 6.7.8/22
     allow 6.7.8.9/22
     allow

The effect of each of these examples is the same as that of the allow directive in the configuration file.


Next: , Previous: allow command, Up: Chronyc command reference
4.3.4.6 allow all

The effect of the allow command is identical to the allow all directive in the configuration file (see allow directive).


Next: , Previous: allow all command, Up: Chronyc command reference
4.3.4.7 burst

The burst command tells chronyd to make a set of measurements to each of its sources over a short duration (rather than the usual periodic measurements that it makes). After such a burst, chronyd will revert to the previous state for each source. This might be either online, if the source was being periodically measured in the normal way, or offline, if the source had been indicated as being offline. (Switching a source between the online and offline states is described in online command, offline command).

The syntax of the burst command is as follows

     burst <n-good-measurements>/<max-measurements> [<mask>/<masked-address>]

The mask and masked-address arguments are optional, in which case chronyd will initiate a burst for all of its currently defined sources.

The arguments have the following meaning and format.

n-good-measurements
This defines the number of good measurements that chronyd will want to obtain from each source. A measurement is good if it passes certain tests, for example, the round trip time to the source must be acceptable. (This allows chronyd to reject measurements that are likely to be bogus.)
max-measurements
This defines the maximum number of measurements that chronyd will attempt to make, even if the required number of good measurements has not been obtained.
mask
This is a dotted quad argument (e.g. 255.255.255.0) with which the IP address of each of chronyd's sources is to be masked.
masked-address
This is a dotted quad argument (e.g. 1.2.3.0). If the masked IP address of a source matches this value then the burst command is applied to that source.

If no mask or masked address arguments are provided, the default is 0.0.0.0 and 0.0.0.0 respectively, which will match every source.

An example of the two-argument form of the command is

     burst 2/10

This will cause chronyd to attempt to get two good measurements from each source, stopping after two have been obtained, but in no event will it try more than ten probes to the source.

An example of the four-argument form of the command is

     burst 2/10 255.255.0.0/1.2.0.0

In this case, the two out of ten sampling will only be applied to sources whose IP addresses are of the form 1.2.x.y, where x and y are arbitrary.


Next: , Previous: burst command, Up: Chronyc command reference
4.3.4.8 clients

This command shows a list of all clients that have accessed the server, through either the NTP or command/monitoring ports. There are no arguments.

An example of the output is

     Hostname                   Client    Peer CmdAuth CmdNorm  CmdBad  LstN  LstC
     =========================  ======  ======  ======  ======  ======  ====  ====
     localhost                       0       0      15       1       0   29y     0
     aardvark.xxx                    4       0       0       0       0    49   29y
     badger.xxx                      4       0       0       0       0     6   29y

Each row shows the data for a single host. Only hosts that have passed the host access checks (set with the allow, deny, cmdallow and cmddeny commands or configuration file directives) are logged.

The columns are as follows:

  1. The hostname of the client
  2. The number of times the client has accessed the server using an NTP client mode packet.
  3. The number of times the client has accessed the server using an NTP symmetric active mode packet.
  4. The number of authenticated command packets that have been processed from the client (i.e. those following a successful password command).
  5. The number of unauthenticated command packets that have been processed from the client.
  6. The number of bad command packets received from the client (not all forms of bad packet are logged).
  7. Time since the last NTP packet was received
  8. Time since the last command packet was received

The last two entries will be shown as the time since 1970 if no packet of that type has ever been received.


Next: , Previous: clients command, Up: Chronyc command reference
4.3.4.9 cmdaccheck

This command is similar to the accheck command, except that it is used to check whether command access is permitted from a named host.

Examples of use are as follows:

     cmdaccheck a.b.c
     cmdaccheck 1.2.3.4


Next: , Previous: cmdaccheck command, Up: Chronyc command reference
4.3.4.10 cmdallow

This is similar to the allow command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow command, Up: Chronyc command reference
4.3.4.11 cmdallow all

This is similar to the allow all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow all command, Up: Chronyc command reference
4.3.4.12 cmddeny

This is similar to the deny command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny command, Up: Chronyc command reference
4.3.4.13 cmddeny all

This is similar to the deny all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny all command, Up: Chronyc command reference
4.3.4.14 cyclelogs

The cyclelogs command causes all of chronyd's open log files to be closed and re-opened. This allows them to be renamed so that they can be periodically purged. An example of how to do this is shown below.

     % mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
     % chronyc
     chronyc> password aardvark
     200 OK
     chronyc> cyclelogs
     200 OK
     chronyc> exit
     % ls -l /var/log/chrony
     -rw-r--r--   1 root     root            0 Jun  8 18:17 measurements.log
     -rw-r--r--   1 root     root        12345 Jun  8 18:17 measurements1.log
     % rm -f measurements1.log


Next: , Previous: cyclelogs command, Up: Chronyc command reference
4.3.4.15 delete

The delete command allows an NTP server or peer to be removed from the current set of sources.

The syntax is illustrated in the examples below.

     delete foo.bar.com
     delete 1.2.3.4

There is one parameter, the name or IP address of the server or peer to be deleted.


Next: , Previous: delete command, Up: Chronyc command reference
4.3.4.16 deny

The effect of the allow command is identical to the deny directive in the configuration file (see deny directive).

The syntax is illustrated in the following examples:

     deny foo.bar.com
     deny 1.2
     deny 3.4.5
     deny 6.7.8/22
     deny 6.7.8.9/22
     deny


Next: , Previous: deny command, Up: Chronyc command reference
4.3.4.17 deny all

The effect of the allow command is identical to the deny all directive in the configuration file (see deny directive).


Next: , Previous: deny all command, Up: Chronyc command reference
4.3.4.18 dump

The dump command causes chronyd to write its current history of measurements for each of its sources to dump files, either for inspection or to support the -r option when chronyd is restarted.

The dump command is somewhat equivalent to the dumponexit directive in the chrony configuration file. See dumponexit directive.

To use the dump, you probably want to configure the name of the directory into which the dump files will be written. This can only be done in the configuration file, see dumpdir directive.


Next: , Previous: dump command, Up: Chronyc command reference
4.3.4.19 exit

The et history o>chronyd is running.

Following the words add peer, the syntax of the following parameters and options is identical to that for the peer directive in the configuration file (see peer directive).

An example of using this command is shown below.

     add peer foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add peer command, Up: Chronyc command reference
4.3.4.4 add server

The add server command allows a new NTP server to be added whilst chronyd is running.

Following the words add server, the syntax of the following parameters and options is identical to that for the server directive in the configuration file (see server directive).

An example of using this command is shown below.

     add server foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add server command, Up: Chronyc command reference
4.3.4.5 allow

The effect of the allow command is identical to the allow directive in the configuration file (see allow directive).

The syntax is illustrated in the following examples:

     allow foo.bar.com
     allow 1.2
     allow 3.4.5
     allow 6.7.8/22
     allow 6.7.8.9/22
     allow

The effect of each of these examples is the same as that of the allow directive in the configuration file.


Next: , Previous: allow command, Up: Chronyc command reference
4.3.4.6 allow all

The effect of the allow command is identical to the allow all directive in the configuration file (see allow directive).


Next: , Previous: allow all command, Up: Chronyc command reference
4.3.4.7 burst

The burst command tells chronyd to make a set of measurements to each of its sources over a short duration (rather than the usual periodic measurements that it makes). After such a burst, chronyd will revert to the previous state for each source. This might be either online, if the source was being periodically measured in the normal way, or offline, if the source had been indicated as being offline. (Switching a source between the online and offline states is described in online command, offline command).

The syntax of the burst command is as follows

     burst <n-good-measurements>/<max-measurements> [<mask>/<masked-address>]

The mask and masked-address arguments are optional, in which case chronyd will initiate a burst for all of its currently defined sources.

The arguments have the following meaning and format.

n-good-measurements
This defines the number of good measurements that chronyd will want to obtain from each source. A measurement is good if it passes certain tests, for example, the round trip time to the source must be acceptable. (This allows chronyd to reject measurements that are likely to be bogus.)
max-measurements
This defines the maximum number of measurements that chronyd will attempt to make, even if the required number of good measurements has not been obtained.
mask
This is a dotted quad argument (e.g. 255.255.255.0) with which the IP address of each of chronyd's sources is to be masked.
masked-address
This is a dotted quad argument (e.g. 1.2.3.0). If the masked IP address of a source matches this value then the burst command is applied to that source.

If no mask or masked address arguments are provided, the default is 0.0.0.0 and 0.0.0.0 respectively, which will match every source.

An example of the two-argument form of the command is

     burst 2/10

This will cause chronyd to attempt to get two good measurements from each source, stopping after two have been obtained, but in no event will it try more than ten probes to the source.

An example of the four-argument form of the command is

     burst 2/10 255.255.0.0/1.2.0.0

In this case, the two out of ten sampling will only be applied to sources whose IP addresses are of the form 1.2.x.y, where x and y are arbitrary.


Next: , Previous: burst command, Up: Chronyc command reference
4.3.4.8 clients

This command shows a list of all clients that have accessed the server, through either the NTP or command/monitoring ports. There are no arguments.

An example of the output is

     Hostname                   Client    Peer CmdAuth CmdNorm  CmdBad  LstN  LstC
     =========================  ======  ======  ======  ======  ======  ====  ====
     localhost                       0       0      15       1       0   29y     0
     aardvark.xxx                    4       0       0       0       0    49   29y
     badger.xxx                      4       0       0       0       0     6   29y

Each row shows the data for a single host. Only hosts that have passed the host access checks (set with the allow, deny, cmdallow and cmddeny commands or configuration file directives) are logged.

The columns are as follows:

  1. The hostname of the client
  2. The number of times the client has accessed the server using an NTP client mode packet.
  3. The number of times the client has accessed the server using an NTP symmetric active mode packet.
  4. The number of authenticated command packets that have been processed from the client (i.e. those following a successful password command).
  5. The number of unauthenticated command packets that have been processed from the client.
  6. The number of bad command packets received from the client (not all forms of bad packet are logged).
  7. Time since the last NTP packet was received
  8. Time since the last command packet was received

The last two entries will be shown as the time since 1970 if no packet of that type has ever been received.


Next: , Previous: clients command, Up: Chronyc command reference
4.3.4.9 cmdaccheck

This command is similar to the accheck command, except that it is used to check whether command access is permitted from a named host.

Examples of use are as follows:

     cmdaccheck a.b.c
     cmdaccheck 1.2.3.4


Next: , Previous: cmdaccheck command, Up: Chronyc command reference
4.3.4.10 cmdallow

This is similar to the allow command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow command, Up: Chronyc command reference
4.3.4.11 cmdallow all

This is similar to the allow all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmdallow all command, Up: Chronyc command reference
4.3.4.12 cmddeny

This is similar to the deny command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny command, Up: Chronyc command reference
4.3.4.13 cmddeny all

This is similar to the deny all command, except that it is used to allow particular hosts or subnets to use the chronyc program to interact with chronyd on the current host.


Next: , Previous: cmddeny all command, Up: Chronyc command reference
4.3.4.14 cyclelogs

The cyclelogs command causes all of chronyd's open log files to be closed and re-opened. This allows them to be renamed so that they can be periodically purged. An example of how to do this is shown below.

     % mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
     % chronyc
     chronyc> password aardvark
     200 OK
     chronyc> cyclelogs
     200 OK
     chronyc> exit
     % ls -l /var/log/chrony
     -rw-r--r--   1 root     root            0 Jun  8 18:17 measurements.log
     -rw-r--r--   1 root     root        12345 Jun  8 18:17 measurements1.log
     % rm -f measurements1.log


Next: , Previous: cyclelogs command, Up: Chronyc command reference
4.3.4.15 delete

The delete command allows an NTP server or peer to be removed from the current set of sources.

The syntax is illustrated in the examples below.

     delete foo.bar.com
     delete 1.2.3.4

There is one parameter, the name or IP address of the server or peer to be deleted.


Next: , Previous: delete command, Up: Chronyc command reference
4.3.4.16 deny

The effect of the allow command is identical to the deny directive in the configuration file (see deny directive).

The syntax is illustrated in the following examples:

     deny foo.bar.com
     deny 1.2
     deny 3.4.5
     deny 6.7.8/22
     deny 6.7.8.9/22
     deny


Next: , Previous: deny command, Up: Chronyc command reference
4.3.4.17 deny all

The effect of the allow command is identical to the deny all directive in the configuration file (see deny directive).


Next: , Previous: deny all command, Up: Chronyc command reference
4.3.4.18 dump

The dump command causes chronyd to write its current history of measurements for each of its sources to dump files, either for inspection or to support the -r option when chronyd is restarted.

The dump command is somewhat equivalent to the dumponexit directive in the chrony configuration file. See dumponexit directive.

To use the dump, you probably want to configure the name of the directory into which the dump files will be written. This can only be done in the configuration file, see dumpdir directive.


Next: , Previous: dump command, Up: Chronyc command reference
4.3.4.19 exit

The et history o>chronyd is running.

Following the words add peer, the syntax of the following parameters and options is identical to that for the peer directive in the configuration file (see peer directive).

An example of using this command is shown below.

     add peer foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add peer command, Up: Chronyc command reference
4.3.4.4 add server

The add server command allows a new NTP server to be added whilst chronyd is running.

Following the words add server, the syntax of the following parameters and options is identical to that for the server directive in the configuration file (see server directive).

An example of using this command is shown below.

     add server foo.bar.com minpoll 6 maxpoll 10 authkey 25


Next: , Previous: add server command, Up: Chronyc command reference
4.3.4.5 allow

The effect of the allow command is identical to the allow directive in the configuration file (see allow directive).

The syntax is illustrated in the following examples:

     allow foo.bar.com
     allow 1.2
     allow 3.4.5
     allow 6.7.8/22
     allow 6.7.8.9/22
     allow

The effect of each of these examples is the same as that of the allow directive in the configuration file.


Next: , Previous: allow command, Up: Chronyc command reference
4.3.4.6 allow all

The effect of the allow command is identical to the allow all directive in the configuration file (see allow directive).


Next: , Previous: allow all command, Up: Chronyc command reference
4.3.4.7 burst

The burst command tells chronyd to make a set of measurements to each of its sources over a short duration (rather than the usual periodic measurements that it makes). After such a burst, chronyd will revert to the previous state for each source. This might be either online, if the source was being periodically measured in the normal way, or offline, if the source had been indicated as being offline. (Switching a source between the online and offline states is described in online command, offline command).

The syntax of the burst command is as follows

     burst <n-good-measurements>/<max-measurements> [<mask>/<masked-address>]

The mask and masked-address arguments are optional, in which case chronyd will initiate a burst for all of its currently defined sources.

The arguments have the following meaning and format.

n-good-measurements
This defines the number of good measurements that chronyd will want to obtain from ea