chrony uses ntp protocol. It designed to get even more accurate time in linux environment. Chrony can also run in any machines that do not have any internet connections or internet connection is very slow such as dial up connections. So, the reference of accurate time can be any clock with high accuracy, but we should able to read the clock and give it to program. In addition and most importantly, it is also capable of calculating the inaccuracy of the hardware clock, and based on that, adjust the hardware clock at boot time. chrony consists of two parts: chronyd daemon and a user interface chronyc.
The following shows that how I installed and configured chrony in my host machine:
yum install chrony #To install chrony daemon in my host machine
service ntpd stop
#I should stop ntpd daemon because they don't work together. I figured out this in /var/log/messages.
Then I configured the chrony configuration file, which is /etc/chrony.conf. I just show important lines:
vi /etc/chrony.conf
server 0.fedora.pool.ntp.org #these are the time servers that I get time through
server 1.fedora.pool.ntp.org #internet connection
server 2.fedora.pool.ntp.org
# Allow client access from local network.
allow 192.168.2/24
keyfile /etc/chrony.keys #key file path
# Specify the key used as password for chronyc.
commandkey 1
logdir /var/log/chrony # logging directory path
log measurements statistics tracking #enable statistics logs
Then, I enabled the commented line in the /etc/chrony.keys file.
1 a_key
Finally, I started my chrony daemon by:
service chronyd start
I typed 'chronyc <command>' to monitor the operation of chronyd. The monitoring commands are:
sources
sourcestats
tracking
The followings are the output of running these commands:
[root@f13 ~]# chronyc tracking
Reference ID : 69.20.226.105 (2.fedora.pool.ntp.org)
Stratum : 3
Ref time (UTC) : Sun Jan 8 20:10:33 2012
System time : 0.448538870 seconds fast of NTP time
Frequency : 0.000 ppm fast
Residual freq : -9891.555 ppm
Skew : 1000000.000 ppm
Root delay : 0.108197 seconds
Root dispersion : 22.964180 seconds
[root@f13 ~]# chronyc sourcestats
210 Number of sources = 3
Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
================================================================
0.fedora.pool.ntp.org 3 3 129 -576.006 194193 +541ms 34ms
1.fedora.pool.ntp.org 3 3 130 -7632.297 1479518 +10ms 125ms
2.fedora.pool.ntp.org 3 3 131 -9891.555 296739 -21us 10ms
[root@f13 ~]# chronyc sources
210 Number of sources = 3
MS Name/IP address Stratum Poll LastRx Last sample
================================================================
^+ 0.fedora.pool.ntp.org 3 6 13 +167ms[ -288ms] +/- 542ms
^* 1.fedora.pool.ntp.org 2 6 10 -83ms[ -538ms] +/- 115ms
^+ 2.fedora.pool.ntp.org 2 6 8 -89ms[ -89ms] +/- 191ms
Now, it is the time to configure the guest machine. The processes are the same as host, but the only difference is that I changed the server address to my host in /etc/chrony.conf.
vi /etc/chrony.conf
server 192.168.2.5 #this is the ip address of my host
Also, there is no need to define client access for local network. So, you can comment that statement. The following is the status of the guest machine:
[root@vm01 ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll LastRx Last sample
===============================================================
^~ 192.168.2.5 16 6 43 -51ms[ -51ms] +/- 1500ms
[root@vm01 ~]# chronyc sourcesstatus
210 Number of sources = 1
MS Name/IP address Stratum Poll LastRx Last sample
================================================================
^* 192.168.2.5 3 6 19 +50ms[ +52ms] +/- 226ms
[root@vm01 ~]# chronyc tracking
Reference ID : 192.168.2.5 (192.168.2.5)
Stratum : 4
Ref time (UTC) : Sun Jan 8 22:45:16 2012
System time : 0.000000354 seconds slow of NTP time
Frequency : 35.881 ppm slow
Residual freq : -0.413 ppm
Skew : 23.131 ppm
Root delay : 0.062902 seconds
Root dispersion : 0.146990 seconds
Accuracy | Advantages | Disadvantage |
Chrony is very accurate and if you look at to the output of chronyc command above, you will see that the accuracy is microsecond. | Chrony supports intermittent internet connections (like a modem). Chrony also keeps track of the computers internal clock error compared to the NTP time to correct the time when the computer isn't connected to the internet (which is also handy even with a continuously connection). | In my opinion, the only major drawback is that chrony is not as widely tested as ntpd and there could be serious bugs hidden. I found some security issues in pervious versions of chrony on internet. |