• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Setup NTP Server (Network Time Protocol)

{{postValue.id}}

To Setup NTP Server (Network Time Protocol)

NTP Server &ndash Network Time Protocol allows systems to synchronize time over networks in an accurate time because it is having port 123 UDP at Transport Layer. This tutorial shows the setup of the NTP server.

Requirements

  • RHEL 7 Installation Procedure
  • CentOS 7 Installation Procedure

Additional Requirements

  • Configure Static IP Address on Centos/Rhel 7
  • Register and Enable RHEL 7 Subscription for Updates
  • Disable and Remove Unwanted Services in Centos/RHEL 7

This guideline explains how to install and configure NTP server on CentOS/RHEL 7 by using NTP Public Pool Time Servers List.

Installation and configuration NTP daemon

The NTP Server Package is default from CentOS/ RHEL 7 repositories.This package can be installed using this command.

[root@linuxhelp ~]# yum install ntp
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centosmirror.go4hosting.in
 * epel: ftp.cuhk.edu.hk
 * extras: centosmirror.go4hosting.in
 * nux-dextop: li.nux.ro
 * updates: centosmirror.go4hosting.in
Resolving Dependencies
-->  Running transaction check
--->  Package ntp.x86_64 0:4.2.6p5-22.el7.centos.1 will be installed
-->  Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
 Package      Arch            Version                             Repository        Size
=========================================================================================
Installing:
 ntp          x86_64          4.2.6p5-22.el7.centos.1             updates          543 k

Transaction Summary
=========================================================================================
Install  1 Package
....      .....     .......
....      .....     .......
....      .....     .......
Installed:
  ntp.x86_64 0:4.2.6p5-22.el7.centos.1                                                   

Complete!

Now the installation of NTP daemon is completed.

After server installation, go to NTP Public Pool Time Servers. Then select your Continent area where the server is located physically. Then search for your country location, list of NTP server is shown.

ntp_public_pool_settings

For editing purpose open NTP daemon main configuration file, the default Public Servers list pool.ntp.org project is there. The list needs to be replaced like in the screenshot below.

[root@linuxhelp ~]# vim /etc/ntp.conf

nto_daemon_config
We need to allow clients to synchronize time. For this, add the NTP configuration file, restrict statement controls are allowing the network to sync time. After that network IPs are replaced.

restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap

NoModify notrap statements are not allowing the clients to configure the server.

Suppose if there is any problem in NTP daemon, add a log file statement it will record all NTP server problems into a one log file.

logfile /var/log/ntp.log

File editing is done with the help of all configuration explained above. Then save the file and close ntp.conf file. Final configuration is shown in the screenshot below.save_ntp_conf_file

Adding Firewall Rules and Start NTP Daemon

NTP is used to resist effects of latency.UDP port 123 on OSI transport layer (layer 4) service is used for NTP.To open this port on RHEL/CentOS 7, firewalld service commands needs to be run.

[root@linuxhelp ~]# firewall-cmd --add-service=ntp --permanent 
success
[root@linuxhelp ~]# firewall-cmd --reload
success

Open firewall port 123, start NTP server and check you enable it in system wide or not.

[root@linuxhelp ~]# systemctl start ntpd
[root@linuxhelp ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
[root@linuxhelp ~]# systemctl status ntpd
? ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service  enabled  vendor preset: disabled)
   Active: active (running) since Fri 2016-03-25 18:46:18 EDT  46s ago
 Main PID: 5880 (ntpd)
   CGroup: /system.slice/ntpd.service
           ??5880 /usr/sbin/ntpd -u ntp:ntp -g

Mar 25 18:46:18 linuxhelp systemd[1]: Starting Network Time Service...
Mar 25 18:46:18 linuxhelp systemd[1]: Started Network Time Service.
Mar 25 18:46:18 linuxhelp ntpd[5880]: proto: precision = 0.041 usec
Mar 25 18:46:18 linuxhelp ntpd[5880]: 0.0.0.0 c01d 0d kern kernel time sync enabled

Verifying Server Time Synch

After NTP daemon starts, wait a few seconds for the server to synchronize time. Then run the commands for verifying NTP peers synchronization status.

[root@linuxhelp ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*srv146.personal 80.96.120.251    2 u    2   64   17  291.786  -68.717  15.128
-94-53-216-184.n 93.190.144.19    3 u    8   64   17  189.416   33.324  19.331
+ntp0.chroot.ro  194.29.130.252   2 u    3   64   17  303.698  -78.520  14.779
+89.149.54.18    80.96.120.252    2 u    2   64   17  411.143    6.987  39.716
[root@linuxhelp ~]# date -R
Fri, 25 Mar 2016 18:50:38 -0400

For query and synchronization, use ntpdate command,used by the servers addresses, given in the command line example.

[root@linuxhelp ~]# ntpdate -q 0.ro.pool.ntp.org  1.ro.pool.ntp.org
server 89.149.54.18, stratum 2, offset 0.033032, delay 0.44189
server 80.96.120.253, stratum 1, offset 0.045323, delay 0.22517
server 89.149.54.30, stratum 2, offset 0.040842, delay 0.45105
server 91.216.151.61, stratum 2, offset -0.006199, delay 0.32443
server 80.96.120.252, stratum 1, offset 0.040745, delay 0.21921
server 89.36.93.8, stratum 2, offset -0.019764, delay 0.33069
server 78.96.7.8, stratum 2, offset 0.038885, delay 0.20006
server 93.190.144.19, stratum 2, offset 0.042758, delay 0.21886
25 Mar 18:53:32 ntpdate[5997]: adjust time server 80.96.120.252 offset 0.040745 sec

Windows Setup NTP Client

For windows set up you have to follow these steps.

Right side of Task bar -> Change Date and Time Settings -> Internet Time tab -> Change Settings -> Check Synchronize with an Internet time server -> put your server’ s IP or FQDN on Server file -> Update now -> OK.

systemctl
date_time
time_settings

Finally NTP server suggests that all clients and servers are taking the same time, in case there is an internet connectivity failure.

Tags:
grayson
Author: 

Comments ( 1 )

sureshbabu
Hi Sir i have followed ur tutorial to set up ntp server in centos 7 When i used ntpdate -q 1.asia.pool.ntp.org It is saying that "no server suitable for synchronization found " Can you plz help me out with this. am using server 0.asia.pool.ntp.org server 1.asia.pool.ntp.org server 2.asia.pool.ntp.org server 3.asia.pool.ntp.org
Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How many clients can I Synchronize from the same NTP server?

A

The T-Series can synchronize up to 100,000 network time clients using the default NTP polling rate of 64 seconds, enough for the largest of networks. Reducing the client polling rate will increase the maximum number of clients still further.

Q

How does NTP work?

A

Superficially, NTP is a software daemon operating in a client mode, server mode, or both.

The purpose of NTP is to reveal the offset of the client’s local clock relative to a time server’s local clock. The client sends a time request packet (UDP) to the server which is time stamped and returned. The NTP client computes the local clock offset from the time server and makes an adjustment. But network latencies, the need to prioritize multiple servers, and the requirement to be self-healing lead to a fairly complicated, yet robust algorithm.

Q

Why Do I Need A Network Time Server?

A

Computers have notoriously inaccurate clocks. They often use cheap, inferior, crystals and clock components. After a relatively short period of time, the clocks of two or more computers will significantly differ. For transaction processing, trading, data logging, and many other applications a consistent network time is imperative to ensure correct operation. A local dedicated network time server is the best solution.

Q

Whether the network time servers easy to install and are they reliable?

A

The time servers from Brandywine Communications are simple to install; connect the power, connect the antenna, set in the IP address, sub-net make and gateway address, connect the server to the network, install the client program in the client computers and the job is done.

All Brandywine Communications network time server products have proven to be extremely reliable. Years of trouble-free operation have been demonstrated and are to be expected.

Q

Whether Is NTP an open source protocol?

A

Yes. It was developed at the University of Delaware by Dr. David Mills, under contract to DARPA. Version 1 was distributed in 1985. The current version can be found here: "http:/www.ntp.org/".

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Jayce ?
What are the types of table used in IPtables

What are the various types of table used in IPtables and how to use that for my server security?

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.