Installing NTP Server on CentOS/RHEL 7/6/5

Network Time Protocol (NTP) is used to synchronize system clocks of different hosts over the network. Most companies will have a local NTP server that they keep in sync with an external timing source and then they have all of their internal servers sync their time with that machine. In this setup, we will configure Linux system as NTP server.

Install the NTP Packages
NTP server package is provided by CentOS/RHEL default repositories and can be installed using yum command.

# yum install ntp

Configure NTP Server
If you have lots of server in the environment and this we will use NTP servers to synchronize time by the ISP or the Public time located at We suggest using any nearby servers also. You can find nearby servers at NTP Public Pool Time Servers (

# vim /etc/ntp.conf
server iburst
server iburst
server iburst
server iburst

Allow LAN Systems
Now, you need to allow clients from your networks to synchronize time with this server. To do it add following entry in configuration file

# vim /etc/ntp.conf
restrict mask nomodify notrap
Enable NTP Log
In case there are problems with your NTP daemon add a log file statement which will record all NTP server issues. Add the following content as below.

# vim /etc/ntp.conf
logfile /var/log/ntp.log

Add Firewall Rules
NTP server listens on UDP port 123. If you are using iptables of the server then run the following command.

# firewall-cmd –add-service=ntp –permanent
# firewall-cmd –reload
CentOS/RHEL 6/5

# iptables -A INPUT -s -p udp –dport 123 -j ACCEPT
# iptables -A INPUT -p udp –dport 123 -j DROP
Restart NTP Server
After all NTP configuration, Let’s restart NTP server using following commands.


# systemctl start ntpd
# systemctl enable ntpd
CentOS/RHEL 6/5

# service ntpd start
# chkconfig ntpd on
Verify Configuration
You can verify the configuration using below command.

# ntpq -p
# date -R

Leave a Reply

Your email address will not be published. Required fields are marked *