Unix Tip: Configuring NTP

Be the first to comment | 1I like it!
October 28, 2004, 04:39 PM —  ITworld.com — 

Send in your Unix questions today!


See additional Unix tips and tricks


Setting up a Unix system to be an NTP client is generally straightforward.
On those Unix platforms that include NTP in the default configuration,
you may only need to make a few adjustments to NTP's default configuration
file for the system to sync up to a reference time server(s) and keep
good time. On a Solaris system, for example, this involves copying a
prototype file and customizing it. You can insert the names or IP addresses
of the time server(s) you have elected to use -- whether public NTP servers
or NTP servers that you have set up on your local network -- or configure
the system to receive broadcast time updates. Once a system has been
configured, the NTP daemon will start whenever the system boots and run
continuously in the background.



Configuration of NTP servers, on the other hand, can be simple or complex,
depending on the options that you wish to use and how well you understand
the NTP service.



Many Unix systems today ship with NTP software. These include Solaris, SCO,
FreeBSD and Mac OS X. On some Linux systems, you will need to download and
install a package, such as ntp-4.1.2-5.i386.rpm, to acquire NTP services.



Once configured, the NTP service requires little or no administration. New
clients will have to be configured and an occasional verification of your
time sources may be warranted, but the service otherwise runs unattended.



Boot-time NTP




If you only want to synchronize your systems at boot time, you can configure
an ntpdate command in your start scripts. This will ensure that your system
starts up with a reasonable clock setting. On a Solaris system, this might
be done with a script like that shown below, installed as /etc/rc2.d/S73ntpdate.




------------------------------ cut here ------------------------------



#!/bin/sh

#

# synchronize date to NTP server at start-up

/usr/sbin/ntpdate -s -b -p 8 -u 129.6.15.28 216.200.93.8


------------------------------ cut here ------------------------------




In this start script, we're synchronizing our system clock to publicly
available time servers in the Washington, DC area. The options used in this
command are as follows:



option means

-s divert logging output to syslogd

-b force time stepping instead of skewing

-p specify number of time samples to be obtained from the server

-u use an unprivileged port (this can be important if privileged ports are

blocked by a firewall). NOTE: NTP uses port 123.




Notice that the ntpdate command in the script includes all the information that
it needs to run, obviating the need to insert this information from the NTP
configuration file.




On systems which boot from rc.conf files (such as FreeBSD and its derivatives),
you would need to modify additional files to use NTP. For example, you would
enable ntpdate in the /etc/rc.conf file by setting ntpdate_enable="YES".
Arguments for the ntpdate command, including the server(s) you intend to
obtain time information from need to be included in the ntpdate_flags line.
These lines might look like this:




ntpdate_enable="YES"

ntpdate_flags="-b 129.6.15.28 216.200.93.8"




Using the ntpdate command on system boot will keep your system clocks in
closer proximity and is generally a good idea. At the same time, for
synchronization, using only boot time commands is of very limited utility.
Many Unix systems run for months, even

I like it!
Post a comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Resources
White Paper

Symantec Backup Exec 12 and Backup Exec System Recovery 8 deliver industry leading Windows data protection and system recovery. Download this whitepaper to find out the top reasons to upgrade and how to get continuous data protection and complete system recovery.

Webcast

Data and system loss — from a hard drive failure, malicious attack, natural disaster, or simple human error — can happen anytime. Don’t leave your business vulnerable. Make sure you have a secure recovery strategy in place. Symantec's latest backup and system recovery technology can efficiently restore critical applications, individual emails and documents and even restore your entire system in minutes in the event of a loss.

White Paper

Businesses face a growing challenge to ensure that the IT environment is properly protected. Backup Exec 12 integrates with other applications in the Symantec family of products, to complement your current data protection strategy, keep your data securely backed up and make it recoverable when you need it most.

Free stuff

Enterprise 2.0 Implementation
By Aaron C. Newman, Jeremy Thomas
Published by McGraw-Hill
Learn more!

Deploying Cisco Wide Area Application Services
By Zach Seils, Joel Christner
Published by Cisco Press
Learn more!

Featured Sponsor

AISO founders envisioned a Web hosting company that was environmentally friendly. While the company employed energy-efficient innovations like solar panels, its infrastructure produced unacceptable power and cooling requirements. Find out how AISO leveraged AMD technology to overcome their challenge in this case study white paper.

In this whitepaper, Scalar explores the opportunity to change the landscape with respect to mission critical databases built around Oracle. Leveraging technologies such as Linux, high-end commodity processing power and Oracle RAC technology to architect, design, build and maintain database infrastructure that delivers maximum availability, reliability and performance at a fraction of traditional cost.

On a typical day, weather.com, the Web site for The Weather Channel in Atlanta, serves up between 15 million and 20 million page views. But in September 2004, when back-to-back hurricanes ransacked Florida, the peak traffic on one day more than tripled: over 70 million page views by more than 7 million unique visitors. Read the full success story now.

More Resources