Wednesday, May 4, 2011

NTP (Network Time Protocol) setup/troubleshooting


Objective:  NTP is used for timesyncing purposes. The clients/servers can get their time synched (to match accuracy) by contacting the NTP server via the NTP protocol.

 Pre-cautions:
  • Date & Time on the system plays a major role for the application/database.
  • Any abrupt change in the date/time/timezone would adversely affect the application/database running.
  • If the difference in the time(between actual & std. time) is more (mnts/hrs); then it is recommended that we take application downtime, before we proceed with system time change or time sync.
Pre-checks:
  •   Check if the ‘ntpd’ daemon/process is running:   ‘ps –ef|grep ntp’   ‘lssrc –s xntpd’
  •   Check the ‘/etc/ntp.conf’ for the ntp servers.
  •  ‘date’ reports date/time/timezone.
  •  Simple script to verify the time difference between two servers: 
  • “while true; do date; done”   [ctrl-c to terminate script] 

Installation Instructions:
  • Take the backup of /etc/ntp.conf file.
  • Stop xntp daemon. “stopsrc –s xntpd”
  • Specify ntp server(of the account) in the ntp.conf file with the ‘server’ keyword.
“cat /etc/ntp.conf|grep -v ^#”
# cat /etc/ntp.conf|grep -v ^#
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace
logfile /etc/ntp.log
server 9.17.129.13               # b03edcore001.ahe.boulder.ibm.com [ntp server]
broadcastclient
#
  • Perform time sync using “ntpdate –v ntpserver”
  • Start the xtnp daemon. “startsrc –s xntpd”; verify the status “lssrc –s xntpd”
  • Look in the /etc/ntp.log for synch status.
  • Verify the time difference, looking at two different server windows(putty)
    • “while true; do date; done”   [ctrl-c to terminate script]
  • If the server is behind firewall, ensure the ‘123’ ntp port is enabled between the server and ntp server.
# cat /etc/services|grep ^ntp
ntp                             123/tcp         # Network Time Protocol
ntp                             123/udp         # Network Time Protocol
# 

Verification / Postchecks:
  • Look in the /etc/ntp.log for synch status.
  • Verify the time difference, looking at two different server windows(putty)
  • “while true; do date; done”   [ctrl-c to terminate script]
 Backout:
Restore the previous ntp.conf and restart ntp daemon.

No comments:

Post a Comment