Mar 20, 2009

Red Hat Configure an NTP Client And Server

how do I configure an NTP (Network Time Protocol) client or server under CentOS / RHEL / Fedora Linux to manage the system clock over a network?

The Network Time Protocol (NTP) is used to synchronize a computer's time with another reference time source. Under CentOS / RHEL you can use NTP or OpenNTPD server software. Both package provides client and server software programs for time synchronization.

Install ntp

The ntp package contains utilities and daemons that will synchronize your computer's time to Coordinated Universal Time (UTC) via the NTP protocol and NTP servers. The ntp packageincludes ntpdate (a program for retrieving the date and time from remote machines via a network) and ntpd (a daemon which continuously adjusts system time). Install the ntp package:

# yum install ntp

How do I configure an NTP Client?

Simply open /etc/ntp.conf file, enter:

# vi /etc/ntp.conf

Make sure the following line exists:


* : the hostname or IP address of the site NTP server. If your ntp server located at, enter server You can also use public ntp server located at

You can also run ntpd using cron:

# echo '30 * * * * root /usr/sbin/ntpd -q -u ntp:ntp' > /etc/cron.d/ntpd

he above instructs crond to run ntpd and after setting the clock just exit, and the -u option instructs it to run as the ntp user.


Configure an NTP Server

Our sample setup: ==> CentOS / Fedora / RHEL NTPD Server.

First, install and enable ntpd on

# yum install ntp
# chkconfig ntpd on

Now open /etc/ntp.conf:

# vi /etc/ntp.conf

Make sure the following line exits:
restrict default ignore

Above will deny all access to any machine, server or client. However, you need to specifically authorized policy settings. Set it as follows: