How to configure and make sure ntpd client is working

Jephe Wu - http://linuxtechres.blogspot.com 

Objective: make sure the NTP client is syncing with the NTP server
Environment:  CentOS 5


Steps:

1. Refer to http://www.pool.ntp.org/en/use.html, configure NTP client as follows:


driftfile /var/lib/ntp/ntp.drift

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
 
For even better result, you can use your continental zones as follows (assuming your
your server is staying in Asia)
 
driftfile /var/lib/ntp/ntp.drift  
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
  
 
2. manually sync clock once (use ntpdate or just date command manually set your clock)
ntpdate -b pool.ntp.org 
or
date 090417252010
 
note: you can also use pool.ntp.org as windows internet time server

3. start up ntpd
chkconfig ntpd on
service ntpd restart

4. checking NTP is working (as normal user or root )
a. /usr/sbin/ntpq -pn  (If you see asterisk is not on localhost clock, it's working. Take note of that this will take up to 15 minutes after ntpd starts up, because it will make sure the local clock is stable first before syncing with the server)

the delay and offset columns should not be zero for the asterisk line

b. ntpstat