Adverts

Using NTP is a great way to keep your system clock set correctly. It works by contacting a number of servers around the world, asking them for the time and then calculating what the correct local time is from their responses. The system works best if you use hosts that are close to you (in network terms) so try and get hosts that are in your country if possible.

The setup, if you just want to maintain one clock, is really simple. Download and install the ntp, ntp-server and ntp-simple packages you probably also need ntpdate to first set your system clock or synchronization will take a very long time. Then edit the /etc/ntp.conf file. You need to add a number of servers to the server list. The Debian default is pool.ntp.org which works but isn't always amazingly accurate because it makes no attempt to use time servers near you. If you want more accuracy use the time servers either on your continent (for instance europe.pool.ntp.org) or your country (for instance uk.pool.ntp.org) one of your local country servers. The optimal number of servers to listen to is three but two will also give a good accuracy. If your ISP runs a time server for you it is worth including it in your server list as it will often be more accurate than the pooled servers and will help keep the load down on the pool. You can use more than one server from a particular country by prefixing the address with a number (for instance 0.uk.pool.ntp.org) but this only works if you are sure there is more than one time server in that country (this will work in the UK).

Once you have finished editing the configuration file start the ntp deamon (/etc/init.d/ntp-server restart) wait a few minutes and then check that your NTP setup is working. Execute "ntpq -p" at a command prompt. It will show something like this:

     remote           refid      st t when poll reach   delay   offset  jitter
====================================================
 thebe.proxy.ecl 195.66.241.3     2 u   43   64    0    0.000    0.000 4000.00
 mailgate.tebiby 66.92.68.246     2 u   41   64    7   33.258    5.281   6.453
 evenstar.silver 195.112.4.14     3 u   41   64    7   24.953  -334.47  33.440

A star by any one of the names means that the system clock is synchronising with the NTP clock. If you don't have a star (as in the example above) it means that the clocks are unreachable, already synchronized to this server or has an outrageous synchronization distance. Try running ntpdate (you will need to stop the ntp server) with your first ntp server as an argument. This will set your system clock fairly accuratly and mean that the server will be able to choose a clock to synchronize with.

When your ntp system is working correctly ntpq -p should display something like this:

     remote           refid      st t when poll reach   delay   offset  jitter
=====================================================
 thebe.proxy.ecl 195.66.241.2     2 u   11   64    0    0.000    0.000 4000.00
*clueful.shagged 132.185.132.130  2 u    8   64  177   14.320   22.958   9.320
+i-195-137-55-38 81.187.242.38    2 u    9   64  177   33.112   21.811   9.238
+gw.roaima.co.uk 139.143.5.57     3 u    5   64  177  118.294   51.572  98.632

which shows that we have a selected server and two backup. The top server is next to useless because of the amount of jitter.

References

Adverts

Donate and Help

Please support this site and
Bandwidth doesn't grow on trees y' know :o)

Adverts

Get Adsense