Steps to install NTP server.
# yum install ntp
Then sync server with 0.rhel.pool.ntp.org, to obtain accurate time data.
After that Open /etc/ntp.conf
Make sure the following line exits:
restrict default ignore
This will deny all access to any machine, server or client.
If this server is also going to provide time for other computers, such as PCs, other Linux servers and networking devices, then you’ll have to define the networks from which this server will accept NTP synchronization requests. You do so with a modified restrict statement removing the noquery keyword to allow the network to query your NTP server. The syntax is:
restrict 10.65.136.128 mask 255.255.255.128 nomodify notrap
At last you need to server value like this
(my local time server all device sync with this
devices or you can use public server for date time.)
# chkconfig ntpd on
# service ntpd start
NTP – Client Setup
For client setup make sure rpm installed.
# yum install ntp
Open ntp.conf file and disable all public server just add a new line like below
Save the file and exit. The run ntpdate command to sync with your ntp server.
[root@raj ~]# ntpdate 10.65.136.154
29 Mar 21:39:03 ntpdate: adjust time server 10.65.136.154 offset 0.000039 sec
Now make sure services on at boot time.
[root@raj ~]# chkconfig ntpd on
[root@raj ~]# /etc/init.d/ntpd start
Starting ntpd: [ OK ]
Verifying NTP is Running
[root@tc1oltp1 ~]# pgrep ntpd
Use the ntpq command to see the servers with which you are synchronized. It provided you with a list of configured time servers and the delay, offset and jitter
[root@tc1oltp1 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
*tc1tools1.myserver LOCAL(0) 11 u 41 64 17 0.514 -0.473 0.461
LOCAL(0) .LOCL. 10 l 38 64 17 0.000 0.000 0.001
Firewall port open at server end add following lines
-A RH-Firewall-1-INPUT -m state –state NEW -p udp –dport 123 -j ACCEPT
save and restart iptables.