13.2.1 Configuring the ntpd Service

To configure the ntpd service on a system:

  1. Install the ntp package.

    # yum install ntp
  2. Edit /etc/ntp.conf to set up the configuration for ntpd.


    The default configuration assumes that the system has network access to public NTP servers with which it can synchronise. The firewall rules for your internal networks might well prevent access to these servers but instead allow access to local NTP servers.

    The following example shows a sample NTP configuration for a system that can access three NTP servers:

    server NTP_server_1
    server NTP_server_2
    server NTP_server_3
    fudge stratum 10
    driftfile /var/lib/ntp/drift
    restrict default nomodify notrap nopeer noquery

    The server and fudge entries for cause ntpd to use the local system clock if the remote NTP servers are not available. The restrict entry allows remote systems only to synchronise their time with the local NTP service.

    For more information about configuring ntpd, see http://doc.ntp.org/4.2.6p5/manyopt.html.

  3. Create the drift file.

    # touch /var/lib/ntp/drift
  4. If remote access to the local NTP service is required, configure the system firewall to allow access to the NTP service in the appropriate zones, for example:

    # firewall-cmd --zone=zone --add-service=ntp
    # firewall-cmd --zone=zone --permanent --add-service=ntp
  5. Start the ntpd service and configure it to start following a system reboot.

    # systemctl start ntpd
    # systemctl enable ntpd

You can use the ntpq and ntpstat commands to display information about the operation of ntpd, for example:

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
*ns1.proserve.nl    2 u   21   64  377   31.420   10.742   3.689
-pomaz.hu       3 u   22   64  377   59.133   13.719   5.958
+server.104media    2 u   24   64  377   32.110   13.436   5.222
+public-timehost    2 u   28   64  377   57.214    9.304   6.311
# ntpstat
synchronised to NTP server ( at stratum 3 
   time correct to within 76 ms
   polling server every 64 

For more information, see the ntpd(8), ntpd.conf(5), ntpq(8), and ntpstat(8) manual pages and http://doc.ntp.org/4.2.6p5/.