Howto configure Network Time Protocol NTP Server on Linux Centos, Ubuntu, Fedora, RHEL

by Ashwin on February 7, 2011

This tutorial will guide you with step by step installation of NTP Server on your server which can help your local network sync the time with it.

Acroynm NTP – Network Time Protocol

Question 1
==> Why do we need network time protocol, why do i need to sync my time with the server. ?
Ans : The easy answer is Security auditing reasons, and the long answer is many application when deployed to work in conjunction with one or more servers to give appropriate data or service (Clustering or Replication) it cannot serve you with two different time on both the servers.

Also it becomes very tedious for a system administrator to analyze logs generated in the same time with different timestamps. So now let dive in to installing NTP on the server.

Go to “http://www.ntp.org/downloads.html” and download the latest stable version of NTP Source (Network Time Protocol on Linux).

ashwin@deskktop /opt]# mkdir ntp
ashwin@deskktop /opt/ntp]# ls
ashwin@deskktop /ntp-4.2.6p3]# tar -zxf ntp-4.2.6p3.tar.gz
ashwin@deskktop /ntp-4.2.6p3]# ./configure
ashwin@deskktop /ntp-4.2.6p3]# make
ashwin@deskktop /ntp-4.2.6p3]# make install

Once NTP is installed you ned to make some change to the ntp.conf located in the /etc directory

open ntp.conf

ashwin@deskktop /ntp-4.2.6p3]# vi /etc/ntp.conf

Add or Edit the following lines

restrict default ignore

# Permit All access the following networks
restrict 127.0.0.1
# Network without restrict but cannot modify time on the server
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Network Time Protocol Servers from where your local NTP server will be updates. Can Check the following link for a pool near to you (http://www.pool.ntp.org/)

server 0.in.pool.ntp.org
server 1.asia.pool.ntp.org
server 0.asia.pool.ntp.org

Save the file

ashwin@deskktop /ntp-4.2.6p3]# service ntpd start
ashwin@deskktop /ntp-4.2.6p3]# ntpq -p

The result showed should not contain 0.0 values in the delay and offset. Once this is done the final step is to check the system firewall or any network firewall in your network to give access to NTP server.

From the Client from where you want to sync the time execute the commands

where 10.0.0.1 is your NTP server IP Address

ashwin@system2 /~]# date -q 10.0.0.1
server 10.0.0.1, stratum 0, offset 0.000000, delay 0.00000
7 Feb 03:52:14 ntpdate[2115]: no server suitable for synchronization found

If you see the above result please check your NTP Server ntp.conf file restrict line and allow your network.

ashwin@system2 /~]# ntpdate -u 10.0.0.1

7 Feb 14:47:26 ntpdate[2664]: step time server 172.16.16.105 offset -1.079103 sec

Hope this tutorial is informative. Please comment your feedback.
For More Linux Tutorials, Linux Howtos Click Here

Network Time Protocol on Linux  Network Time Protocol on Linux  Network Time Protocol on Linux  Network Time Protocol on Linux
Plugin by: PHP Freelancer

Related posts:

  1. Howto Install RED5 Flash Media Server in Fedora 11, Centos 5.4, Redhat Red5 is an Open Source Flash Media Server written in...
  2. How to Change System Timezone on Linux Distros – Centos, Ubuntu, Redhat, Fedora Many a times after initial installation of Linux operating system...
  3. Packet Capturing and Analayzing packets Using TCPDUMP on Centos, Fedora, Ubuntu and other Linux Distros Many a times Linux System Admin2 face problem in network...
  4. How to mount RAMFS, TMPFS in Centos, RHEL, Fedora, Ubuntu, Linux How to Use and mount RAMFS / TMPFS in Centos,...

Leave a Comment

Spam Protection by WP-SpamFree

Previous post:

Next post: