If you have your own server, why not consider joining the pool.ntp.org project to help provide accurate time to many client machines?
NTP, or Network Time Protocol, is a method for computers to obtain the current time accurately in order to keep their clocks correct. Even when set accurately, the clock on most computers will eventually drift until it is no longer accurate – often made worse when the computer is being heavily loaded.
NTP allows a client to ask a time server to tell it the current time. The “main” timeservers have accurate timekeeping equipment connected (GPS receivers are common) to give them the correct time. Other timeservers simply keep in sync with several main servers, and accept requests from client machines.
What is the pool.ntp.org project?
The pool.ntp.org project is a big virtual cluster of timeservers striving to provide reliable easy to use NTP service for millions of clients without putting a strain on the big popular timeservers.
The “pool” contains a number of servers, often operated by volunteers, using DNS to automatically spread clients between available servers. This allows client machines to simply use a hostname like uk.pool.ntp.org which will resolve to a suitable server.
The pool is now enormously popular, being used by millions of systems around the world. It’s the default “time server” for most of the major Linux distributions. At the time of writing there are 1,419 servers taking part in the pool.
How to join the pool
Firstly, be aware that joining the pool is a relatively long-term commitment; it’s easy enough to remove your machine from the pool, but due to the way NTP clients operate it may take weeks before the inbound NTP traffic fully stops, and if your machine isn’t answering requests during that time, it may interfere with clients ability to obtain an accurate time.
You’ll need a reasonable server with a permanent, reliable Internet connection and a static IP address; ideally a server hosted in a datacentre somewhere. If you have a UK2 dedicated server, that will do the trick nicely 🙂
Running an NTP server doesn’t require massive CPU power or bandwidth (NTP packets are small UDP packets, generally 76 bytes). To give you an idea what to expect: my NTP server is currently answering requests at an average rate of 22 requests per second. At that rate, you can expect to transfer approximately 4GB per month, which is hardly a lot of bandwidth – especially if you have a UK2 server with our generous 10,000GB monthly data transfer allowance!
Firstly, you’ll need to install ntpd if you don’t already have it installed. I use Debian, and was able to install it quickly and easily with:
apt-get install ntp
You’ll need to edit /etc/ntp.conf to add several good servers. Look at the stratum 2 servers list and pick some geographically close to you. I would recommend 4-5 good servers, perhaps 6-7. For each server, add a line to ntp.conf like:
Most servers are listed as OpenAccess, which means that anyone may use them; if the server has “Yes” in the Notify column then you’re asked to notify the owner of the server that you wish to peer with them – this is not a requirement but should be followed. If a server is listed as RestrictedAccess you should not use it until you’ve contacted the server owner and gained their approval.
Once you have ntp.conf filled out correctly, start NTP (for Debian/Ubuntu, /etc/init.d/ntp start ought to do it), you can use the ntpq command to list the servers your server is going to peer with:
davidp@lyla:~$ ntpq -pn remote refid st t when poll reach delay offset jitter ============================================================================== +22.214.171.124 126.96.36.199 2 u 799 1024 377 8.229 0.732 0.209 188.8.131.52 .INIT. 16 u - 1024 0 0.000 0.000 0.000 -184.108.40.206 220.127.116.11 2 u 790 1024 377 13.052 0.196 0.188 +18.104.22.168 22.214.171.124 2 u 790 1024 377 2.523 0.756 0.002 -126.96.36.199 188.8.131.52 2 u 707 1024 377 24.704 -1.895 0.576 184.108.40.206 .INIT. 16 u - 1024 0 0.000 0.000 0.000 -220.127.116.11 18.104.22.168 2 u 692 1024 357 1.902 5.485 2.791 -22.214.171.124 126.96.36.199 2 u 780 1024 377 12.798 0.269 0.142 *188.8.131.52 184.108.40.206 2 u 833 1024 377 12.783 0.698 0.105 x220.127.116.11 LOCAL(1) 11 u 803 1024 377 110.197 414168. 254.906
List your server
You will not see traffic immediately; the pool.ntp.org system will monitor your server for a while and ensure that it seems reliable. Once your server has reached an “availability score” of 5 or more, it will be included in the DNS. You can expect this to take a few hours at least.