Keeping Accurate Time on Linux - Page 3
When your ntpd setup is working, it can function as the time server for your LAN. This is extremely preferable to configuring every PC on your network to synchronize with the public time servers. (That is time server abuse.)
Install and configure ntpd on them, just like for your local server, with one difference: edit /etc/ntp.conf to point to your local time server. And that's all there is to it. (Don't forget /etc/default/ntp-servers on Debian.)
Is It Working?
Use the following command to ensure everything is working. Note, though, that it’s normal for this command to not show any results for 30-60 minutes after starting NTP.
# ntpq -p
remote refid st t when poll reach delay offset jitter
+clock.fmt.he.ne .GPS. 1 u 37 64 377 105.562 26.771 2.539
+dewey.lib.ci.ph reaper.twc.weat 2 u 25 64 377 398.666 -30.285 51.555
*clock.sjc.he.ne .CDMA. 1 u 21 64 377 98.269 15.298 4.000
There are two useful things in this output: 1) it's working, and 2) the * and + prefixes indicate that the time servers are good and that ntpd can use them. Any other prefix indicates a problem of some sort. The simplest fix is to delete the entry in ntp.conf and try a different server.
More ntp.conf Entries
These additional entries are helpful to have:
The driftfile is where ntpd writes variations between your system clock and the time servers so that it can instantly calculate a starting point after a reboot. Otherwise, it has to start re-calculating with each reboot, and that takes time. Be sure to create these files if they don't already exist.
If you don't specify a logfile, ntpd will dump entries into the system log.
Intermittent Internet Connection
ntpd works best on a full-time Internet connection. If you're on dial-up, it will still work and you can still have a local machine designated as the LAN time server. The trick here is to add ntpdate to the brew. Run ntpdate every time your dial-up connection starts. Put this script in /etc/ppp/ip-up.d and name it anything you like. I call it "ntpdate":
# ntpdate script
# run /etc/init.d/ntpdate every time PPP starts
if [ -x /etc/init.d/ntpdate]; then
This makes it executable for all users – season to taste:
# chmod a+rx /etc/ppp/ip-up.d/ntpdate
And that, in a nutshell, is how to have your own local time server. Yes, it really is that simple.