Configure NTP Server And Client Linux Clustering

Configure NTP Server
-----------------------
1)Edit file /etc/ntp.conf file.
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10


Configure NTP CLIENT
-----------------------
2)Edit /etc/ntp.conf
server NTP-Server-IP
How To Start the Service Update The Time From The NTP Server
1)First we have to update the time using ntpdate command.
2)then we have to restart the ntp service using /etc/init.d/ntp restart.
or else we will get the error message.
23 Feb 10:55:37 ntpdate[4696]: the NTP socket is in use, exiting
For Example
# date
Sat Feb 23 11:40:39 EST 2013
# ntpdate 10.1.1.4
23 Feb 09:05:59 ntpdate[2095]: step time server 10.1.1.4 offset -9284.738053 sec
# date
Sat Feb 23 09:06:05 EST 2013
after that only we have to restart the ntp service.#/etc/init.d/ntp restart

Verification Method to check ntp service
We should confirm with refid it is  should like
LOCAL(0)(or)any IP-Address format.
Status of the refid should change from INIT to some IP (or) LOCAL(0). Like Below
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
================================================
 node3.niper.in  LOCAL(0)        11 u   11   64   17    0.688   -1.025 5401072

Instead if we were getting like .INIT. or .LOCL. then client machine it won't synchronize with the master server.problem persist in the ntp server we have to rectify that.
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
================================================
 10.154.0.158    .INIT.          16 u   30   64    0    0.000    0.000   0.000
 LOCAL(0)        .LOCL.          10 l   29   64    1    0.000    0.000   0.004

NOT Resolved Error - 1)

Client machine is synchronize but it is not updating time for example..
# date
Sat Feb 23 20:38:44 CST 2013
# ntpdate 10.154.0.158
23 Feb 20:38:49 ntpdate[12491]: adjust time server 10.154.0.158 offset -0.003176 sec
# date
Sat Feb 23 20:38:52 CST 2013

0 comments:

Post a Comment