{"id":1436,"date":"2018-11-18T10:10:08","date_gmt":"2018-11-18T07:10:08","guid":{"rendered":"http:\/\/kifarunix.com\/?p=1436"},"modified":"2024-03-11T21:34:59","modified_gmt":"2024-03-11T18:34:59","slug":"how-to-install-and-configure-ntp-server-using-chrony-on-fedora-29","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/how-to-install-and-configure-ntp-server-using-chrony-on-fedora-29\/","title":{"rendered":"How to Install and Configure NTP Server Using Chrony on Fedora 29\/Fedora 28"},"content":{"rendered":"\n
In this tutorial, we are going to learn how to install and configure NTP server using Chrony on Fedora 29\/Fedora 28.<\/p>\n\n\n\n
NTP (Network Time Protocol) is an network protocol that enables clock synchronization between computer systems over packet-switched, variable-latency data networks. Accurate time keeping is paramount in system administration. There are two daemons that can provide network time synchronization in RHEL-based distros, chronyd <\/strong> and ntpd<\/strong> provided by the Chrony and ntp packages respectively.<\/p>\n\n\n\n The chrony daemon, chronyd, can be controlled by the command line utility chronyc. To install chrony, run the command below;<\/p>\n\n\n\n After the installation, the chronyd daemon is running by default. You can check the status by running the command below;<\/p>\n\n\n\n You can also enable it to start on system boot by running the command below;<\/p>\n\n\n\n After the installtion of Chrony suite, you need to configure it in order to provide the NTP services in your environment. The default configuration file for chronyd is \/etc\/chrony.conf<\/strong>.<\/p>\n\n\n\n To begin configuration, you need to change the line, To obtain a list of these servers, navigate to http:\/\/www.pool.ntp.org\/en\/<\/a> and choose your continent area where the servers are physically located. Search for your country location and a list of NTP servers should appear. For example, in this guide we are choosing the time servers as shown in the screenshot below;<\/p>\n\n\n\n Therefore, edit the \/etc\/chrony.conf<\/strong> and comment out the line, Next, you need to specify a host, subnet, or network from which to allow NTP connections to your NTP server. The default is not to allow connections. As an example, to allow hosts on the network subnet 192.168.43.0\/24, your configuration would look like;<\/p>\n\n\n\n The Chronyd listens on UDP port 123 and therefore this port needs to be open in the firewall in order to allow the client access:<\/p>\n\n\n\n After that, restart chronyd.<\/p>\n\n\n\n To check if chrony is synchronized, make use of the To check chrony tracking<\/strong>, run the following command:<\/p>\n\n\n\n The The The The M <\/strong>column indicates the mode of the source;<\/p>\n\n\n\n The S<\/strong> column indicates the state of the sources;<\/p>\n\n\n\n The Setting NTP client on Fedora is the same as setting the NTP server. The difference is that NTP client time is synchronized with the NTP server, in this case the server you set above and it doesn’t have access permissions set hence no server can query time information from it.<\/p>\n\n\n\n To setup NTP client using the chrony suite, install chrony<\/strong> on the client.<\/p>\n\n\n\n Enable chronyd to start on system boot;<\/p>\n\n\n\n Edit the chronyd configuration file and set the time server address as shown below;<\/p>\n\n\n\n where 192.168.43.69<\/strong> is the IP address of our NTP server.<\/p>\n\n\n\n After that, restart chronyd.<\/p>\n\n\n\n To verify that time synchronization is working, you can use the tracking or sources command with chronyc as shown below;<\/p>\n\n\n\n From the reference ID, you can see that our client is connected to our NTP server.<\/p>\n\n\n\n You can also use the sources command;<\/p>\n\n\n\n As you can see, our client is now connected to our NTP server.<\/p>\n\n\n\n That is all about installing and setting up Chrony to provide NTP services on Fedora 29. We hope this was informative.<\/p>\n\n\n\n Setup NTP server Using NTPd on Debian 10 Buster<\/a><\/p>\n\n\n\n Configure NTP Server using NTPd on Fedora 30<\/a><\/p>\n\n\n\n How to Install and Configure NTP Server Using NTPd on Fedora 29\/Fedora 28<\/a><\/p>\n\n\n\nConfigure NTP Server Using Chrony on Fedora 29\/Fedora 28<\/h2>\n\n\n\n
Installing Chrony<\/h3>\n\n\n\n
sudo dnf install chrony -y<\/code><\/pre>\n\n\n\n
systemctl status chronyd<\/code><\/pre>\n\n\n\n
systemctl enable chronyd<\/code><\/pre>\n\n\n\n
Configuring Chrony<\/h3>\n\n\n\n
Set the time servers<\/h4>\n\n\n\n
pool 2.fedora.pool.ntp.org iburst<\/code> that specifies the time servers used for time synchronization, to servers that are close to your timezone area.<\/p>\n\n\n\n
<\/a><\/figure>\n\n\n\n
pool 2.fedora.pool.ntp.org iburst<\/code>, replacing it as shown below<\/p>\n\n\n\n
vim \/etc\/chrony.conf<\/code><\/pre>\n\n\n\n
\n...\n# pool 2.fedora.pool.ntp.org iburst\nserver 0.africa.pool.ntp.org iburst\nserver 1.africa.pool.ntp.org iburst\nserver 2.africa.pool.ntp.org iburst\nserver 3.africa.pool.ntp.org iburst\n...\n<\/code><\/pre>\n\n\n\n
...<\/strong>\n# Allow NTP client access from local network.\n#allow 192.168.0.0\/16\nallow 192.168.43.0\/24\n<\/strong>...<\/strong><\/code><\/pre>\n\n\n\n
firewall-cmd --add-port=123\/udp --permanent\nfirewall-cmd --reload<\/code><\/pre>\n\n\n\n
systemctl restart chronyd<\/code><\/pre>\n\n\n\n
Checking if chrony is Synchronized<\/h2>\n\n\n\n
tracking<\/code>,
sources<\/code>, and
sourcestats<\/code> commands.<\/p>\n\n\n\n
Checking chrony Tracking<\/h3>\n\n\n\n
chronyc tracking<\/code><\/pre>\n\n\n\n
\nReference ID : B23E73D4 (cacti.digital-satellites.com)\nStratum : 3\nRef time (UTC) : Sat Nov 17 20:43:46 2018\nSystem time : 0.000046934 seconds slow of NTP time\nLast offset : -0.008311978 seconds\nRMS offset : 0.072417602 seconds\nFrequency : 9.445 ppm fast\nResidual freq : -21.688 ppm\nSkew : 10.302 ppm\nRoot delay : 0.254697442 seconds\nRoot dispersion : 0.020058062 seconds\nUpdate interval : 1.3 seconds\nLeap status : Normal\n<\/code><\/pre>\n\n\n\n
reference ID<\/code> specifies the reference ID and hostname or IP address of the server to which the computer is currently synchronized with.<\/p>\n\n\n\n
Stratum<\/code> indicates the number of hops between your local computer and the reference clock computer.<\/p>\n\n\n\n
Checking chrony Sources<\/h3>\n\n\n\n
sources<\/code> command shows the information about the current time sources that chronyd is accessing.<\/p>\n\n\n\n
chronyc sources<\/code><\/pre>\n\n\n\n
\n210 Number of sources = 4\nMS Name\/IP address Stratum Poll Reach LastRx Last sample \n===============================================================================\n^* cacti.digital-satellites> 2 6 77 32 +34ms[ +25ms] +\/- 136ms\n^+ ntp2.inx.net.za 2 6 77 33 -58ms[ -67ms] +\/- 206ms\n^? 2a02:8106:1:8800::3 0 6 0 - +0ns[ +0ns] +\/- 0ns\n^- cpt-ntp.mweb.co.za 2 6 77 34 -334ms[ -183ms] +\/- 477ms\n<\/code><\/pre>\n\n\n\n
\n
\n
Checking chrony Source Statistics<\/h3>\n\n\n\n
sourcestats<\/code> command displays information about the drift rate and offset estimation process for each of the sources currently being examined by chronyd<\/p>\n\n\n\n
chronyc sourcestats<\/code><\/pre>\n\n\n\n
\n210 Number of sources = 4\nName\/IP Address NP NR Span Frequency Freq Skew Offset Std Dev\n==============================================================================\ncacti.digital-satellites> 12 7 26m +18.050 176.634 -39ms 78ms\nntp2.inx.net.za 8 5 1194 +157.886 637.815 +9602us 94ms\n2a02:8106:1:8800::3 0 0 0 +0.000 2000.000 +0ns 4000ms\ncpt-ntp.mweb.co.za 13 8 20m +21.438 131.489 +86ms 37ms\n<\/code><\/pre>\n\n\n\n
Setup NTP Client<\/h2>\n\n\n\n
dnf install chrony<\/code><\/pre>\n\n\n\n
systemctl enable chronyd<\/code><\/pre>\n\n\n\n
Configure Chrony<\/h3>\n\n\n\n
# Use public servers from the pool.ntp.org project.\n# Please consider joining the pool (http:\/\/www.pool.ntp.org\/join.html).\n#pool 2.fedora.pool.ntp.org iburst\nserver 192.168.43.69<\/strong><\/code><\/pre>\n\n\n\n
systemctl restart chronyd<\/code><\/pre>\n\n\n\n
Check time synchronization<\/h3>\n\n\n\n
chronyc tracking <\/code><\/pre>\n\n\n\n
\nReference ID : C0A82B45 (192.168.43.69)<\/strong>\nStratum : 4\nRef time (UTC) : Sun Nov 18 07:04:29 2018\nSystem time : 0.004202977 seconds fast of NTP time\nLast offset : +0.007200314 seconds\nRMS offset : 0.107927606 seconds\nFrequency : 91.718 ppm fast\nResidual freq : +3.508 ppm\nSkew : 159.694 ppm\nRoot delay : 0.299425781 seconds\nRoot dispersion : 0.080330342 seconds\nUpdate interval : 64.2 seconds\nLeap status : Normal\n<\/code><\/pre>\n\n\n\n
chronyc sources<\/code><\/pre>\n\n\n\n
\n210 Number of sources = 1\nMS Name\/IP address Stratum Poll Reach LastRx Last sample \n===============================================================================\n^* 192.168.43.69 3 6 377 31 -3512us[ -13ms] +\/- 213ms\n<\/code><\/pre>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n