Keeping Accurate Time on Linux - Page 2

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

Finding Public Time Servers

First up, where to find time servers? Visit Public NTP Time Servers. Select servers that are closest to you. Geographically close is good, or you can test network proximity with ping and traceroute.

Select three to five servers; don't rely on any single one. Be sure to pay attention to the access policies for each server, because some are open and some have restrictions (musn't be guilty of time server abuse).

ntp.conf entries look like this:

server    clock.fmt.he.net
server    dewey.lib.ci.phoenix.az.us
server    clock.sjc.he.net

While your time zone is probably set correctly already, it's easy enough to check:

$ ls -al /etc/localtime
lrwxrwxrwx 1 root root 30 Nov 25 13:45 /etc/localtime -> /usr/share/zoneinfo/US/Pacific

If you need to change it, use the ln command:

# ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime

If your system time is off by more than a few minutes, ntpd will not correct it. ntpdate will give it a good jumpstart:

# ntpdate [server name]

Starting ntpd depends on your Linux distribution. If you installed it from RPM or apt-get, it's probably already running and the init scripts are in place. On Red Hat, try 'restart' or 'start' first:

# service ntpd restart

On other Linuxes:

# /etc/init.d/ntpd restart

Debian Is Different, Of Course

Note that Debian uses the ntp-simple package, and you have to install ntp-docs separately. After installation, you'll find them on your system at /usr/share/doc/ntp-doc/html/.

Debian also uses /etc/default/ntp-servers to set the time servers for /etc/init.d/ntpdate. The easiest time server configuration method on Debian is:

# dpkg-reconfigure ntp-simple

You may also edit the configuration files directly. dpkg-reconfigure will add your server list to both /etc/default/ntp-servers and /etc/ntp.conf.

To restart the ntp daemon on Debian, use this command:

# /etc/init.d/ntp-simple restart

Page 3: LAN Clients

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 >