{"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<p>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<p>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, <strong>chronyd <\/strong> and <strong>ntpd<\/strong> provided by the Chrony and ntp packages respectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configure NTP Server Using Chrony on Fedora 29\/Fedora 28<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Chrony<\/h3>\n\n\n\n<p>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<pre class=\"wp-block-preformatted\"><code>sudo dnf install chrony -y<\/code><\/pre>\n\n\n\n<p>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<pre class=\"wp-block-preformatted\"><code>systemctl status chronyd<\/code><\/pre>\n\n\n\n<p>You can also enable it to start on system boot by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable chronyd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configuring Chrony<\/h3>\n\n\n\n<p>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 <strong>\/etc\/chrony.conf<\/strong>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Set the time servers<\/h4>\n\n\n\n<p>To begin configuration, you need to change the line, <code>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<p>To obtain a list of these servers, navigate to <a href=\"http:\/\/www.pool.ntp.org\/en\/\" target=\"_blank\" rel=\"noopener noreferrer\">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<figure class=\"wp-block-image\"><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2018\/11\/ntp-time-servers.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1256\" height=\"736\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2018\/11\/ntp-time-servers.png\" alt=\"How to Install and Configure NTP Server Using Chrony on Fedora 29\/Fedora 28\" class=\"wp-image-1437\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2018\/11\/ntp-time-servers.png 1256w, https:\/\/kifarunix.com\/wp-content\/uploads\/2018\/11\/ntp-time-servers-768x450.png 768w\" sizes=\"(max-width: 1256px) 100vw, 1256px\" \/><\/a><\/figure>\n\n\n\n<p>Therefore, edit the <strong>\/etc\/chrony.conf<\/strong> and comment out the line, <code>pool 2.fedora.pool.ntp.org iburst<\/code>, replacing it as shown below<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/chrony.conf<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\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<p>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<pre class=\"wp-block-code\"><code><strong>...<\/strong>\n# Allow NTP client access from local network.\n#allow 192.168.0.0\/16\n<strong>allow 192.168.43.0\/24\n<\/strong><strong>...<\/strong><\/code><\/pre>\n\n\n\n<p>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<pre class=\"wp-block-preformatted\"><code>firewall-cmd --add-port=123\/udp --permanent\nfirewall-cmd --reload<\/code><\/pre>\n\n\n\n<p>After that, restart chronyd.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart chronyd<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Checking if chrony is Synchronized<\/h2>\n\n\n\n<p>To check if chrony is synchronized, make use of the <code>tracking<\/code>, <code>sources<\/code>, and <code>sourcestats<\/code> commands.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Checking chrony Tracking<\/h3>\n\n\n\n<p>To check <strong>chrony tracking<\/strong>, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chronyc tracking<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\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<p>The <code>reference ID<\/code>&nbsp; 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<p>The <code>Stratum<\/code> indicates the number of hops between your local computer and the reference clock computer.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Checking chrony Sources<\/h3>\n\n\n\n<p>The <code>sources<\/code> command shows the information about the current time sources that chronyd is accessing.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chronyc sources<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\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<p>The <strong>M <\/strong>column indicates the mode of the source;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>^ means a server<\/li>\n\n\n\n<li>= means a peer<\/li>\n\n\n\n<li># indicates a locally connected reference clock<\/li>\n<\/ul>\n\n\n\n<p>The <strong>S<\/strong> column indicates the state of the sources;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u201c*\u201d indicates the source to which chronyd is currently synchronized.<\/li>\n\n\n\n<li>\u201c+\u201d indicates acceptable sources which are combined with the selected source.<\/li>\n\n\n\n<li>\u201c-\u201d indicates acceptable sources which are excluded by the combining algorithm.<\/li>\n\n\n\n<li>\u201c?\u201d indicates sources to which connectivity has been lost or whose packets do not pass all tests. This condition is also shown at start-up, until at least 3 samples have been gathered from it.<\/li>\n\n\n\n<li>\u201cx\u201d indicates a clock which chronyd thinks is a falseticker (its time is inconsistent with a majority of other sources).<\/li>\n\n\n\n<li>\u201c~\u201d indicates a source whose time appears to have too much variability<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Checking chrony Source Statistics<\/h3>\n\n\n\n<p>The <code>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<pre class=\"wp-block-code\"><code>chronyc sourcestats<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\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<h2 class=\"wp-block-heading\">Setup NTP Client<\/h2>\n\n\n\n<p>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&#8217;t have access permissions set hence no server can query time information from it.<\/p>\n\n\n\n<p>To setup NTP client using the chrony suite, install <strong>chrony<\/strong> on the client.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install chrony<\/code><\/pre>\n\n\n\n<p>Enable chronyd to start on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable chronyd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure Chrony<\/h3>\n\n\n\n<p>Edit the chronyd configuration file and set the time server address as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 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\n<strong>server 192.168.43.69<\/strong><\/code><\/pre>\n\n\n\n<p>where <strong>192.168.43.69<\/strong> is the IP address of our NTP server.<\/p>\n\n\n\n<p>After that, restart chronyd.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart chronyd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Check time synchronization<\/h3>\n\n\n\n<p>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<pre class=\"wp-block-code\"><code>chronyc tracking <\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n<strong>Reference 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<p>From the reference ID, you can see that our client is connected to our NTP server.<\/p>\n\n\n\n<p>You can also use the sources command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chronyc sources<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\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<p>As you can see, our client is now connected to our NTP server.<\/p>\n\n\n\n<p>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<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/setup-ntp-server-using-ntpd-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Setup NTP server Using NTPd on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/configure-ntp-server-using-ntpd-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Configure NTP Server using NTPd on Fedora 30<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-install-and-configure-ntp-server-using-ntpd-on-fedora-29-fedora-28\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">How to Install and Configure NTP Server Using NTPd on Fedora 29\/Fedora 28<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/setup-ntp-server-using-chrony-on-centos-8\/\" target=\"_blank\" rel=\"noopener noreferrer\" aria-current=\"page\">Setup NTP Server using Chrony on CentOS 8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we are going to learn how to install and configure NTP server using Chrony on Fedora 29\/Fedora 28. NTP (Network Time Protocol)<\/p>\n","protected":false},"author":1,"featured_media":12718,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,236,237],"tags":[241,1304,239,240,242,924,238,1305],"class_list":["post-1436","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-ntp","category-rhel","tag-chrony","tag-chrony-fedora-29-28-30","tag-chronyc","tag-chronyd","tag-fedora","tag-fedora-30","tag-ntp","tag-ntp-server-chrony-fedora","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1436"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=1436"}],"version-history":[{"count":11,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1436\/revisions"}],"predecessor-version":[{"id":21061,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1436\/revisions\/21061"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12718"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=1436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=1436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=1436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}