What is NTP , Configure private NTP server in Redhat Linux

Configuring NTP Server in REDHAT Linux

Before doing the configuration , we discuss some of the basic concepts about the NTP server.

What is NTP

NTP stands for Network Time Protocol, and it is an Internet protocol used to synchronize the clocks of computers to some time reference ,the time reference can be a computer or router device.

NTP uses Coordinated Universal Time (UTC) to synchronize computer clock times to a millisecond, and sometimes to a fraction of a millisecond. UTC time is obtained using several different methods, including radio and satellite systems. Specialized receivers are available for high-level services such as the Global Positioning System (GPS) and the governments of some nations. Computers and devices are designed to get the time from those servers or devices which are getting time information directly from radio and satellite systems.

NTP uses a hierarchical, semi-layered system of time sources. Each level of this hierarchy is termed a “stratum” and is assigned a number starting with zero at the top. A server synchronized to a stratum n server will be running at stratum n+1. The number represents the distance from the reference clock and is used to prevent cyclical dependencies in the hierarchy.




Why NTP

Accurate time across a network is important for many reasons; even small fractions of a second can cause problems. For example, distributed procedures depend on coordinated times to ensure that proper sequences are followed. Security mechanisms depend on coordinated times across the network. File system updates carried out by a number of computers also depend on synchronized clock times. Air traffic control systems provide a graphic illustration of the need for coordinated times, since flight paths require very precise timing (imagine the situation if air traffic controller computer clock times were not synchronized).

How to Configure NTP in REDHAT Linux

Configure NTP server :

1) Install the ntp package

rpm -ivh ntp-4.2.2p1-9.el5_3.2.x86_64.rpm

or 

yum install ntp

2) Configure NTP Server

edit the /etc/ntp.cof

paste below lines into the file.
################
restrict 127.0.0.1 

# Hosts on local network are less restricted.
restrict 192.9.1.0 mask 255.255.0.0 nomodify notrap

server 127.127.1.0 prefer
fudge   127.127.1.0 stratum 10

driftfile /var/lib/ntp/drift

#############

NOTE : If you have your own NTP server use that server ipaddress instead of “server 127.127.1.0 prefer” mentioned in the above file.
server

3) Configure the firewall

iptables -I INPUT -p udp –dport 123 -j ACCEPT

iptables -L

service iptables save

4) restart the service

service ntpd restart

after five minutes you can see output like below.

execute the “ntpq -p” command , you can see below output

Configure NTP Client

1) install ntp package as done for server

add below lines to the ntp.conf of client.

[root@node2 etc]# cat ntp.conf
# Point to our network’s master time server
server 192.9.1.100

restrict default ignore
restrict 127.0.0.1
restrict 192.9.1.100 mask 255.255.255.255 nomodify notrap noquery

driftfile /var/lib/ntp/drift

2)restart the ntp service

service ntpd restart

3) execute the “ntpq -p” , you can see the below output after 5 mins.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s