Keeping Accurate Time on Linux

The network time protocol can ensure accurate, synchronized time across your entire network. Carla Schroder explains how to set up a local time server on Linux and how to configure it so that every PC on your network synchronizes with the server.

By Carla Schroder | Jan 22, 2004
Page 1 of 3
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn

Keeping accurate, synchronized time across your network is important for all sorts of reasons: for accurate time stamps in logs, for ensuring that processes run on time, and also for applications that depend on keeping good time. Fortunately, it doesn’t have to be a difficult process to manage, as ntpd, the NTP (network time protocol) daemon, can do all the work for you.

Typically, with ntpd you can "set it and forget it." The hard part is wading through the documentation and finding the bits that tell you how to implement and configure it, and what programs and configuration files you’ll need. You know the old cliché about asking the time and being told how to build a watch? I think the NTP project may have inspired it.

In this article we’ll cover how to set up a local time server on a LAN, without discussing the protocol itself at all, even though it is very cool. Instead, we shall stay focused on telling the time, not on building a watch.

Most Linux distributions include a motley collection of time and date utilities: hwclock.sh, date, 822-date, tzselect, tzsetup, vcstime, uptime, zdump, ddate, rdate, ctime, and doubtless several more. These tools have all sorts of odd, specialized functions, and are fun to play with on occasion. In the olden days we kept time with hwclock.sh, rdate, or ntpdate. They ran at boot or were put in cron jobs for periodic updating.

ntpd replaces hwclock.sh, rdate, and ntpdate. I recommend disabling any of these that are set to run automatically, whether from init or cron, and instead let ntpd be your sole timekeeper. With one exception — for ntpdate, don't delete those init scripts; save them.

Quick Start

After installation, all you need to do is:

  • Add some public time servers to /etc/ntp.conf
  • Set your time zone. Make a symlink from /etc/localtime to the appropriate file in /usr/share/zoneinfo
  • Make sure that UDP port 123 is open through your firewall
  • Run ntpdate to set the system time
  • Start up ntpd

Let's take these steps one at a time.

Page 2: Finding Public Time Servers

Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter
Helpful Links
  • Yankee Group Mobile WAN Optimization Report

    Mobile work continues to evolve. Your organization must keep up with the demands of its mobile workforce. This report introduces the concept of mobile WAN optimization and provides three case studies including RCM, PRTM and Einstein that highlight how this emerging technology can help IT departments achieve what previously appeared to be conflicting goals. Read >

  • Network Security Resources

    More threats than ever before pose a danger to today's enterprise network. Get the latest tips and intel on the newest risks in our guide to network security resources. Read >

  • Extreme Savings: Cutting Costs with WAN Optimization

    Did you know it's possible to cut IT costs without impacting day-to-day IT operations? In fact, when you download this whitepaper from Riverbed on cost-savings through WAN optimization, you'll discover how businesses of all different sizes have realized a return on investment in just a few months through significant hard cost savings in areas such as bandwidth reduction and IT consolidation. It's called Extreme Savings and its only from Riverbed. Read >