If you want to set up a local time server, use ntp. It will synchronize with a public time server, and your LAN clients will connect to the local machine. This example assumes the PC acting as the local time server has a full-time Internet connection.
Next, make sure the
daemon is not running:
# /etc/init.d/ntpd stop
On Debian, use:
# /etc/init.d/ntp-server stop
#/etc/ntp.conf driftfile /etc/ntp.drift logfile /var/log/ntp.log server pool.ntp.org server pool.ntp.org server pool.ntp.org
Make the initial time correction with
# ntpdate pool.ntp.org
Then start up
# /etc/init.d/ntpd start
On Debian, use:
# /etc/init.d/ntp-server start
# 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
Be patient, because it takes a few minutes for a server list to appear and up to 30 minutes for the first correction to take place. The * and + prefixes indicate that the connections were successful and synchronization is occurring.
ntpd makes small, incremental changes over a period of time.
By itself, it will take hours, or even days, to adjust the system
time, depending how far off it is. If the system time is off by more
than 60 minutes,
is the quickest way to make the initial correction.
ntpdate will not run if
ntpd is running.
The maintainers at ntp.org are trying to deprecate
ntpdate, claiming that
ntpd -g, which is
ntpd's "burst" command, does the same
thing. Unfortunately, it doesn't handle corrections larger than 60
minutes any faster than
ntpdate is still useful.
Using the same entry in
ntp.conf three times—
server pool.ntp.org—puts three different
hits on the DNS pool at your disposal, so you'll never have to worry
about servers being unavailable.
Learn more about this topic from Linux Cookbook.
Linux information can be found scattered in man pages, texinfo files, and source code comments, but the best source is the experts who have built up a working knowledge of managing Linux systems. The Linux Cookbook's tested techniques distill years of hard-won experience into practical cut-and-paste solutions to everyday Linux dilemmas. Use just one recipe from this collection of real-world solutions, and the hours of tedious trial-and-error saved will more than pay for the cost of the book. It's more than a time-saver; it's a sanity saver.