Ntp usage


Linux Configuration files


restrict default notrap 
server     # local clock
fudge stratum 10
driftfile /var/lib/ntp/drift
broadcastdelay  0.008
keys            /etc/ntp/keys


# Drop root to id 'ntp:ntp' by default.
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
# Set to 'yes' to sync hw clock after successful ntpdate

For RAC implement NTP with slewing option ( -x )  

Applicable to platforms:  All Linux and Unix Platforms.

Why?: Without the slew option NTP will shift the system clock forwards or backwards when the time discrepancy exceeds a specific (platform dependent) threshold. Large backward time shifts can result in the Clusterware thinking that checkins have been missed resulting in node evictions. For this reason it is highly recommended that NTP be configured to slew time (speed up or slow down) the clock to synchronize the time to prevent such evictions.  For more information on how to implement NTP time slewing on your platform please refer to the Platform Specific RAC and Oracle Clusterware Best Practice and Starter Kit Notes (see below).

Start and stop NTP service

On CentOS/RHEL/Fedora:
$ service ntpd start
$ chkconfig ntpd on
$ service ntpd stop

# /etc/init.d/ntpd stop
 Shutting down ntpd:                                        [  OK  ]
# /etc/init.d/ntpd  start
 Starting ntpd:                                             [  OK  ]

Synchronize time with a known ntp server using ntpdate

# ntpdate -u
 27 May 12:46:52 ntpdate[2925]: adjust time server offset 0.420523 sec

Query all NTP servers defined in /etc/ntp.conf

# ntpq -p
 remote           refid      st t when poll reach   delay   offset  jitter
 =============== ==============================================================
 nurnberg-rtr-1-   3 u    7   64    1    1.204  506.456   0.031
 LOCAL(0)        .LOCL.          10 l    4   64    1    0.000    0.000   0.031

Doing An Initial Synchronization

The ntpdate command  runs three times to synchronize  clock, but it must be run while the ntpd
process is stopped. So you’ll have to stop ntpd, run ntpdate and then start ntpd again.


Initial settings:
#  ntpq -p
 remote           refid      st t when poll reach   delay   offset  jitter
 nurnberg-rtr-1-   3 u   87  128  377    0.964  -198.53 8951.67
 *LOCAL(0)        .LOCL.          10 l   20   64  377    0.000    0.000   0.000

 Stop NTPD service:
 #    service ntpd stop
 Shutting down ntpd:                         [  OK  ]

Run ntpdate:
# ntpdate -u
 1 Jun 17:24:04 ntpdate[24229]: adjust time server offset -0.244832 sec

Restart NTPD service:
# service ntpd start
 Starting ntpd:                                             [  OK  ]

Confirm time sycronization:
# ntpq -p
 remote           refid          st t when poll reach   delay   offset  jitter
 nurnberg-rtr-1-   3 u    4   64    1    1.000  -240.43   5.110
 LOCAL(0)        .LOCL.          10 l    3   64    1    0.000    0.000   0.000
--> Times server is polled every 64 seconds - last polled issued 4 seconds ago
    the current time difference is 240 ms - the difference between last 2 runs is 5.11 ms

 remote:      The remote peer or server being synced to. “LOCAL” is this local host (included in case there are no remote peers or servers available); 
 refid:       Where or what the remote peer or server is itself synchronised to;
 st :         The remote peer or server Stratum
 t:           Type (u: unicast or manycast client, b: broadcast or multicast client, l: local reference clock, s: symmetric peer, A: manycast server, B: broadcast server, M: multicast server, see “Automatic Server Discovery“);
 when:        number of seconds passed since last response
 poll:        polling interval, in seconds, for source
 reach:       indicates success/failure to reach source, 377 all attempts successful
 delay:       indicates the roundtrip time, in milliseconds, to receive a reply
 offset:      indicates the time difference, in milliseconds, between the client server and source
 disp/jitter: indicates the difference, in milliseconds, between two samples

Add the following  lines to rc.local to syncronize date on every VirtualBox reboot

# stop service to all ntpdate to work
service ntpd stop
ntpdate -u
service ntpd start



Leave a Reply

Your email address will not be published. Required fields are marked *