{"id":2829,"date":"2019-05-05T13:57:10","date_gmt":"2019-05-05T10:57:10","guid":{"rendered":"https:\/\/kifarunix.com\/?p=2829"},"modified":"2022-05-14T07:59:03","modified_gmt":"2022-05-14T04:59:03","slug":"configure-ntp-server-using-ntpd-on-fedora-30","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/configure-ntp-server-using-ntpd-on-fedora-30\/","title":{"rendered":"Configure NTP Server using NTPd on Fedora 30"},"content":{"rendered":"\n<p>In this guide, we are going to learn how to configure NTP server using NTPd on Fedora 30. NTP server broadcasts date and time information in order to keep the time clocks on networked computer systems synchronized to a common reference over the network or the Internet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configure NTP Server using NTPd on Fedora 30<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Disable Chrony<\/h3>\n\n\n\n<p>Chrony is another versatile implementation of the NTP that can be used  as a replacement of the the default user space NTP daemon and is installed by default on Fedora 30.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>rpm -qa | grep chrony<br>chrony-3.4-2.fc30.x86_64<\/code><\/pre>\n\n\n\n<p>Both Chrony Daemon (chronyd) and NTPd cannot run at the same time and hence stop and disable Chrony Daemon so as to use NTPd.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl stop chronyd<br>systemctl disable chronyd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install NTP Daemon (ntpd)<\/h3>\n\n\n\n<p>NTP daemon is provided by the ntp package which is available by default on Fedora 30 repos.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install ntp<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configuring NTP on Fedora 30<\/h3>\n\n\n\n<p>The main configuration file for NTP is <strong>\/etc\/ntp.conf<\/strong>. Hence, to make configuration changes, open this file with your preferred editor.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/ntp.conf<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Access Control to an NTP Service<\/h4>\n\n\n\n<p>The NTP daemon implements a general purpose address\/mask based restriction list. Restriction can be implemented using the <strong>restrict<\/strong> command. The <strong>restrict<\/strong> command syntax is;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>restrict address [mask mask] [other options]<\/code><\/pre>\n\n\n\n<p>To configure NTP to allow LAN systems to get time services from the NTP server, you need to define the network address as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Hosts on local network are less restricted.\n#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap\nrestrict 192.168.0.0 mask 255.255.255.0 nomodify notrap<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>The&nbsp;<code>nomodify<\/code>&nbsp;options prevents any changes to the configuration.<\/li><li>The&nbsp;<code>notrap<\/code>&nbsp;option prevents&nbsp;<code>ntpdc<\/code>&nbsp;control message protocol traps.<\/li><\/ul>\n\n\n\n<p>You can read more about restrict and other command options on <strong>man ntp.conf<\/strong>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Public NTP Servers Entries<\/h4>\n\n\n\n<p>NTP is configured to use time servers from the Fedora pool by default. These servers are used for time synchronization. Hence, you can obtain a list of the servers on your timezone (or your Continent) from  <a rel=\"noreferrer noopener\" href=\"http:\/\/www.pool.ntp.org\/en\/\" target=\"_blank\">NTP Public Pool Time Servers <\/a>and add them as shown below;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\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 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<h4 class=\"wp-block-heading\">Configure the Firewall to Allow Incoming NTP Packets<\/h4>\n\n\n\n<p>The&nbsp;<code>NTP<\/code>&nbsp;traffic consists of&nbsp;<code>UDP<\/code>&nbsp;packets on port&nbsp;<code>123<\/code>. You need to permit traffic to this port through Firewalld.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>firewall-cmd --add-port=123\/udp --permanent<br>firewall-cmd --reload<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Running NTPd<\/h4>\n\n\n\n<p>To start and enable NTPd to run on system boot, run the commands belows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl start ntpd<br>systemctl enable ntpd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Verify NTP<\/h4>\n\n\n\n<p>To verify if NTP server is working fine, try to list your NTP peers.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ntpq -p<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n     remote           refid      st t when poll reach   delay   offset  jitter\n==============================================================================\n*ntp4.inx.net.za 0.60.139.194     2 u   55   64   27  197.626  -44.526  50.599\n+102.130.49.223  85.199.214.98    2 u   58   64   37  197.764  -46.516  48.474\n+helpdesk.digita 196.10.55.57     3 u   60   64   37  198.201   -7.566  35.213\n 196.9.24.88     146.64.8.7       2 u   70   64   16  160.210  -36.686  53.051\n<\/code><\/pre>\n\n\n\n<p>That seems fine. Proceed to configure NTP client.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configuring NTP Client<\/h2>\n\n\n\n<p>Now that your NTP server is up and running, configure the NTP client to  synchronize its time from your NTP server. In this guide, we are using Ubuntu 18.04 server as our NTP client. The configurations of the NTP client is mostly similar to the configuration of the NTP server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Synchronize time manually using ntpdate<\/h3>\n\n\n\n<p>Run the command below to install ntpdate on Ubuntu 18.04<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install ntpdate<\/code><\/pre>\n\n\n\n<p>To manually synchronize time with NTP server using <strong>ntpdate<\/strong>;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ntpdate 192.168.0.101<br> 5 May 13:22:49 ntpdate[2831]: adjust time server 192.168.0.101 offset -0.025443 sec<\/code><\/pre>\n\n\n\n<p>Well, seems all is well with manual time synchronization.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Synchronize time automatically with NTP<\/h3>\n\n\n\n<p>Run the command below to install ntp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install ntp<\/code><\/pre>\n\n\n\n<p>NTP service is set to run by default after installation on Ubuntu 18.04. To configure the NTP client to synchronize time from your NTP server, edit the ntp configuration file and replace the public NTP pool servers with your server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/ntp.conf<br><\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n...\n# Specify one or more NTP servers.\n\n# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board\n# on 2011-02-08 (LP: #104525). See http:\/\/www.pool.ntp.org\/join.html for\n# more information.\n#pool 0.ubuntu.pool.ntp.org iburst\n#pool 1.ubuntu.pool.ntp.org iburst\n#pool 2.ubuntu.pool.ntp.org iburst\n#pool 3.ubuntu.pool.ntp.org iburst\nserver 192.168.0.101 iburst\n...\n<\/code><\/pre>\n\n\n\n<p>You can as well just add your server to the configuration file and make it the preferred reference clock. This can be achieved by the use of the <strong>prefer<\/strong> option.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>server 192.168.0.101 prefer iburst<\/code><\/pre>\n\n\n\n<p>Save the configuration file and restart ntp. You also need to disable Systemd timesyncd ntp.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>timedatectl set-ntp off<br>systemctl restart ntp<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Verify time synchronization<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>ntpq -p<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n     remote           refid      st t when poll reach   delay   offset  jitter\n==============================================================================\n*192.168.0.101   196.9.24.88      3 u    -   64    1    0.851    0.233   0.498\n ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000\n alphyn.canonica 194.58.203.20    2 u    5   64    1  294.794  -31.291   0.000\n chilipepper.can 17.253.34.253    2 u    6   64    1  270.919  -50.307   0.000\n pugot.canonical 145.238.203.14   2 u    4   64    1  264.920  -50.840   0.000\n golem.canonical 145.238.203.14   2 u    3   64    1  274.537  -56.011   0.000\n<\/code><\/pre>\n\n\n\n<p>Enable NTP to run on system boot.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable ntp<\/code><\/pre>\n\n\n\n<p>For the basic configurations, that is just it on how to configure NTP server using NTPd on Fedora 30.<\/p>\n\n\n\n<p>Check our other guides on Fedora 30 by following the links below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-3-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install MariaDB 10.3 on Fedora 30<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/administer-fedora-30-29-from-web-using-cockpit\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Administer Fedora 30\/29 from Web using Cockpit<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-apache-on-fedora-30\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install Apache on Fedora 30<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we are going to learn how to configure NTP server using NTPd on Fedora 30. NTP server broadcasts date and time information<\/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,930],"tags":[924,238,243,5142],"class_list":["post-2829","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-ntp","category-ntpd","tag-fedora-30","tag-ntp","tag-ntpd","tag-setup-ntp-server-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\/2829"}],"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=2829"}],"version-history":[{"count":3,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/2829\/revisions"}],"predecessor-version":[{"id":12727,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/2829\/revisions\/12727"}],"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=2829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=2829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=2829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}