Commands / Services and tunnels

Services and tunnels

chronyc

Also chrony, ntp, time sync, clock

Asks the chrony time daemon which clocks it follows, how far off its own clock is, and changes its sources.

chrony keeps a clock right with NTP; chronyc talks to the running daemon. chronyc tracking is its view of its own clock: the Reference ID it follows, its stratum (one more than its source's), and System time, how far the clock is from NTP time. chronyc sources lists each server and its state: ^* followed, ^+ combined, ^- agreeing but unused, ^x a falseticker outvoted by the others, ^? unusable. Reach is the last eight exchanges as bits in octal: 377 is all answered, 0 none.

chronyc command usage

chronyc [-n] tracking|sources [-v]|clients|serverstats
chronyc add server ADDRESS [iburst]
chronyc delete ADDRESS
chronyc allow|deny [all|SUBNET]

Options

-n
show addresses, not names
tracking
the source it follows, its stratum and its clock's offset
sources -v
each server, its state and last offset, with a legend
add server ADDRESS iburst
start using one more server, with a quick first burst
allow / deny all
who may ask this daemon for the time, changed while it runs

chronyc examples

chronyc tracking
Shows which clock this one follows, its stratum, and how far off it is.
chronyc sources
Lists the servers it asks, which one it follows, and which it ignores.
chronyc add server 10.0.2.10 iburst
Starts using one more time server without a restart.
chronyc clients
Lists the devices that ask this server for the time.

Reading the output

$ chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^+ timeServer                    2   1   377     1    -11us[  -11us] +/-   65us
^x brokenClock                   2   0   377     1  +17520h[+17520h] +/-   82us
^* referenceClock                1   0   377     1  -9213ns[-9938ns] +/-   75us
  • ^*: the source followed; ^+: agrees and is averaged in; ^x: a falseticker, ignored because the others disagree with it.
  • Reach 377: the last eight queries all answered (octal); Poll 1: every 2^1 seconds.
  • Last sample: this clock minus the server's. +17520h: this clock is 730 days ahead of brokenClock.

Pitfalls

  • With one or two sources nothing can be outvoted: a single wrong server is simply believed.
  • chronyc add, delete, allow and deny change the running daemon only; chrony.conf is what survives a restart.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab