Linux – Using NTP (Network Time Protocol)

NTP will connect to a server to get the atomic time. It can be downloaded from www.ntp.org/downloads.html To get started with NTP simply download it, install it, use the ntpdate command followed by a public time server, and update your hardware clock.


$ ntpdate "server DNS name or IP address"
4 Nov 22:31:28 ntpdate[26157]: step time server 209.81.9.7 offset 22317290.440932 sec
$ hwclock --systohc

A public time server can be found at http://support.ntp.org/bin/view/Servers/WebHome

To keep your time accurate you can create a cron job that executes:
(the -w option is the same as –systohc)


ntpdate "server name" && hwclock -w

To stay independent of a particiluar server you can use 0.pool.ntp.org (0, 1, or 2) for the server name. This domain uses DNS round robin to choose different time servers every so often. This keeps certain nameservers from having high loads. The only disadvantage is the increased potential of updating time from a nameserver who is in the pool but has an incorrect time settings.

These are volunteer public servers so be polite, do not constantly access the public servers, use only public servers (not private), and if you have multiple machines, set up a ntp server and have your other machines retrieve the time from your local server. Check http://www.eecis.udel.edu/~mills/ntp/servers.html for detailed rules.

Leave a Reply

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

*