NTP howto

From Rsewiki
Revision as of 09:33, 13 June 2008 by Jca (talk | contribs) (New page: This is a short description on how to get two computers have the same clock using NTP (Network Time Protocol) '''NTPD how''' NTPD - ntp deamon (ntpd) - must run on both (all) computers t...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is a short description on how to get two computers have the same clock using NTP (Network Time Protocol)

NTPD how

NTPD - ntp deamon (ntpd) - must run on both (all) computers that needs to be synchronised.

The ntpd configuration is typically at

/etc/ntp.conf

The sync is - should - be obtained in two steps:

  • initial (as root)
ntpdate -u 192.168.1.10

This will update the clock on this computer to the clock on the 192.168.1.10 computer (if the difference is above 0.5 second - else nothing is changed). The accuracy is typically better than 1 ms.

The clocks will then drift - often between 0.1 to 1 ms each second - this (often) needs to be controlled:

  • keep sync (as root)
ntpd

ntpd will try to adjust the clock-speed to get an equal clock speed on the two clocks, without ever setting the clock. No steps backwards.

The sync takes time

When ntpd is started it will decide which server is the better, this takes typically about 8 minutes (requires about 8 samples spaced 64 seconds).

Test progress

as root the status can be monitored by, e.g.:

root@smr19:/rhome/demo# ntpq -p
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 LOCAL(0)        .LOCL.          16 l    3   64  377    0.000    0.000   0.001
*pc89.iau.dtu.dk LOCAL(0)         3 u   58   64  377    0.257  -24.219   0.423

This shows that the pc89 computer is the time source (the * as first character) the offset is -24.219 ms The last poll was performed 58 seconds ago and the poll interval is 64 seconds.

After a few hours the clock difference will reduce to about the magnitude of the jitter (in miliseconds).

Configuration