Search

Friday, October 05, 2012

Setup ntpd

To synchronize your unix to the HK time servers:

1.    service stop ntpd
2.    ntpdate hk.pool.ntp.org  // we set a sensible time first
3.    vi /etc/ntp.conf and put the followings.

server 0.hk.pool.ntp.org
server 1.hk.pool.ntp.org
server 2.hk.pool.ntp.org

driftfile /var/lib/ntp/drift

4.    service start ntpd

Soon, you will see the ntp status.  For illustration:
#ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*203.129.68.14   192.168.51.202   2 u   60   64   17    7.094    7.683   3.114
+202.131.74.126  210.0.235.14     3 u   61   64   17   10.296    6.702   4.906
 127.127.1.0     .LOCL.          10 l    -   64   37    0.000    0.000   0.008

The actual ip addresses will be different as you are assigned random servers from the pool.  The important thing is the '*' sign in front of one of them, meaning that your server is now getting time from internet.

Troubleshooting
If you are unable to synchronize with the time servers, please check that UDP port 123 is opened.


No comments:

Post a Comment