329 lines
12 KiB
HTML
329 lines
12 KiB
HTML
<!--startcut ======================================================= -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<html>
|
|
<head>
|
|
<META NAME="generator" CONTENT="lgazmail v1.1H.i">
|
|
<TITLE>The Answer Guy 37: Ahh ... The Toils of Time</TITLE>
|
|
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
|
|
LINK="#3366FF" VLINK="#A000A0">
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<H4>"The Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
|
|
<P> <hr> <P>
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<center>
|
|
<H1><A NAME="answer">
|
|
<img src="../../gx/dennis/qbubble.gif" alt="(?)"
|
|
border="0" align="middle">
|
|
<font color="#B03060">The Answer Guy</font>
|
|
<img src="../../gx/dennis/bbubble.gif" alt="(!)"
|
|
border="0" align="middle">
|
|
</A></H1>
|
|
<BR>
|
|
<H4>By James T. Dennis,
|
|
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a><BR>
|
|
Starshine Technical Services,
|
|
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
|
|
</H4>
|
|
</center>
|
|
|
|
<p><hr><p>
|
|
<!-- endcut ======================================================= -->
|
|
<!-- begin 22 -->
|
|
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
|
|
height="50" width="60" alt="(?) " border="0"
|
|
>Ahh ... The Toils of Time</H3>
|
|
|
|
|
|
<p><strong>From cly on Mon, 11 Jan 1999
|
|
</strong></p>
|
|
<!-- ::
|
|
Ahh ... The Toils of Time
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
:: -->
|
|
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
|
|
HEIGHT="28" WIDTH="50" BORDER="0"
|
|
>
|
|
Hi!
|
|
My problem is, that the system clock runs too fast,
|
|
about 4 mins/3 days.
|
|
</STRONG></P>
|
|
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
|
|
HEIGHT="28" WIDTH="50" BORDER="0"
|
|
>
|
|
That's a pretty bad clock. However, there are ways to
|
|
cope with it.
|
|
</BLOCKQUOTE>
|
|
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
|
|
HEIGHT="28" WIDTH="50" BORDER="0"
|
|
>
|
|
It's a big problem, because this server is time server for some
|
|
workstations.
|
|
</STRONG></P>
|
|
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
|
|
HEIGHT="28" WIDTH="50" BORDER="0"
|
|
>
|
|
Are you using timed, xntpd or some other time
|
|
synchronization server/protocol?
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
If you have a dedicated connection to the Internet,
|
|
I'd recommend using xntpd --- and thus using the
|
|
NTP protocol.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
This is a complex protocol with largely inaccessible
|
|
documentation. So far as the average sysadmin is
|
|
concerned it should simply be a matter of installing
|
|
xntpd on one or more Internet accessible (bastion)
|
|
hosts --- such as your nameserver and external
|
|
mail relay, and providing it with a suitable
|
|
configuration file.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Mine looks like:
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE><BLOCKQUOTE><CODE>
|
|
<BR>#/etc/ntp.conf
|
|
<BR>server nebu1-atm.ucsd.edu ## (132.239.254.49)
|
|
<BR>server ns.scruz.net ## (165.227.1.1)
|
|
<BR>server 127.127.1.0 # local clock (LCL)
|
|
<BR>fudge 127.127.1.0 stratum 10 # LCL is unsynchronized
|
|
<BR>driftfile <TT>/etc/ntp.drift</TT>
|
|
</CODE></BLOCKQUOTE></BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
... note that the servers I've chosen are listed among
|
|
the Stratum-2 (secondary) public time servers at
|
|
the NTP web pages:
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE><BlockQuote>
|
|
<A HREF="http://www.eecis.udel.edu/~ntp"
|
|
>http://www.eecis.udel.edu/~ntp</A>
|
|
</BlockQuote></BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
... also note that you should ping and run ntpdate
|
|
against any of these before you try to use them as
|
|
one of your xntpd time source servers. (This list
|
|
is sadly out of date --- and includes hosts which
|
|
haven't responded to my pings and time requests
|
|
in a couple of years --- and that's just from a
|
|
sampling of the ones in California!).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
But I'm getting ahead of myself. First you need to
|
|
ensure that your clock is even close (within 1000 seconds)
|
|
of the correct time before you load the xntpd daemon.
|
|
So, during startup you should run the 'ntpdate' command
|
|
to set your system time. (I also run the <TT>/sbin/clock</TT> -w
|
|
command to write the system time to the CMOS hardware
|
|
clock --- and have a cron job to repeat that command
|
|
once a day).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Using this technique during startup you have your
|
|
system time in the right ballpark. (The cron job also
|
|
limits how far off your CMOS/hardware clock can drift).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Then you have your startup scripts load the NTP daemon
|
|
after your networking interfaces and routes have been
|
|
established. Then this daemon will periodically poll
|
|
its time servers, measuring the networking delays and
|
|
arriving at a precise approximation of the UTC time.
|
|
I gather that the default is every 17 minutes. You'll
|
|
see UDP traffic between port 123 on the clients and
|
|
servers.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
I recommend that you configure at least one exposed
|
|
(bastion) server with xntpd and another one or
|
|
two internal hosts which access the externally visible
|
|
one. Then all of your internal systems can access
|
|
the internal (stratum-4) time servers. If you have
|
|
less than a hundred systems your external systems
|
|
should probably refer to stratum-2 servers (to limit
|
|
the load on the primary (stratum-1) servers).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
You can also buy hardware clocks which xntpd can use
|
|
to set the time. Some of them are radio clocks, other
|
|
monitor GPS (global positioning system) or Loran signals
|
|
(which would also be considered "radio" clocks I guess)
|
|
and others are high precision clocks embedded on PC or other
|
|
interfaces.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Thus, if you connect a GPS or Loran based high precision
|
|
clock to one of your servers you can be your own stratum-1
|
|
time source. (If you go to the expense of buying one of
|
|
these --- and they can cost over $1000 US --- I highly
|
|
recommend that you make that server publicly available as a
|
|
primary NTP server).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
I gather that there are also modem based time services that
|
|
are supported by the NTP package. I have yet to see any
|
|
configuration examples for using these.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Note:
|
|
</BLOCKQUOTE>
|
|
|
|
<blockquote><blockquote>
|
|
It has sometimes been the experience that the local clock oscillator
|
|
frequency error is too large for the NTP discipline algorithm, which
|
|
can correct frequency errors as large as 30 seconds per day. There are
|
|
two possibilities that may result in this problem. First, the hardware
|
|
time- of-year clock chip must be disabled when using NTP, since this
|
|
can destabilize the discipline process. This is usually done using the
|
|
tickadj program and the -s command line argument, but other means may
|
|
be necessary. For instance, in the Sun Solaris kernel, this must be
|
|
done using a command in the system startup file.
|
|
</blockquote></blockquote>
|
|
<BLOCKQUOTE>
|
|
... in your case your system may require a bit of extra
|
|
work to get xntpd working reliably. You're experiencing
|
|
over a minute per day in slew --- so you'll almost
|
|
certainly need read these details from the NTP home page.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
As I've said --- the biggest failing in the xntpd package
|
|
is that the documentation is written like a doctoral thesis.
|
|
It add incredible complexity to a process that should be
|
|
very simple to the "user" (the typical sysadmin, in this
|
|
case).
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
Another problem with the whole system (protocol, utilities
|
|
etc) is that it's designed for systems with dedicated
|
|
Internet connections. No provisions or suggestions are made
|
|
for those of us with dial-up (dial on demand) connection
|
|
over modems, ISDN lines, etc.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
My solution was to create a cron job that kill the
|
|
xntpd on my internal time server once every day ---
|
|
fired up my link to the 'net, ran 'ntpdate' against
|
|
three different servers and then restarted the daemon.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
This is specifically NOT recommended in the NTP
|
|
documentation. They are concerned that the sudden
|
|
change in time might confuse some daemons and processes.
|
|
However, it seems to be the only choice for those of us
|
|
that want to maintain reasonable time synchronization
|
|
but don't have the money to spend on dedicated internet
|
|
connections and/or hardware clocks.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
You can find a list of those high precision time clocks
|
|
at the NTP web pages. I'm must sorry that you'll have to
|
|
muddle through all that erudite prose to get at the
|
|
information you want.
|
|
</BLOCKQUOTE>
|
|
<BLOCKQUOTE>
|
|
(Meanwhile I have changed my network and I do have
|
|
a dedicated connection (DSL) now. So if anyone wants
|
|
to send me a good GPS PC/clock I'll be happy to set up
|
|
an ntp.starshine.org public time server
|
|
<IMG SRC="../../gx/dennis/smily.gif" ALT=";)"
|
|
height="24" width="20" align="middle">).
|
|
</BLOCKQUOTE>
|
|
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
|
|
HEIGHT="28" WIDTH="50" BORDER="0"
|
|
>
|
|
My config:
|
|
</STRONG></P>
|
|
<P><STRONG><BlockQuote>
|
|
<A HREF="http://www.slackware.org/">Slackware</A> 3.5 with 2.0.36 kernel on iP200MMX
|
|
<br>What to do?
|
|
<br>Cly
|
|
</BlockQuote></STRONG></P>
|
|
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
|
|
HEIGHT="28" WIDTH="50" BORDER="0"
|
|
>
|
|
I hope that helps. I don't know if xntpd is
|
|
included with Slackware --- but you can certainly find
|
|
and build the source package from any good Linux archive
|
|
site or from the NTP home pages that I've listed above.
|
|
</BLOCKQUOTE>
|
|
<!-- sig -->
|
|
|
|
<!-- end 22 -->
|
|
<!--startcut ======================================================= -->
|
|
<P> <hr> <P>
|
|
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
|
|
>Copyright ©</a> 1999, James T. Dennis
|
|
<BR>Published in <I>The Linux Gazette</I> Issue 37 February 1999</H5>
|
|
<P> <hr> <P>
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<P align="center">
|
|
<table width="98%"><tr valign="center" align="center">
|
|
<td rowspan="3" colspan="4"><A HREF="../lg_answer37.html"><IMG
|
|
SRC="../../gx/dennis/answernew.gif"
|
|
ALT="[ Answer Guy Index ]"></A></td>
|
|
<TD width="8%"><A HREF="./1.html">1</A></TD>
|
|
<TD width="8%"><A HREF="./2.html">2</A></TD>
|
|
<TD width="8%"><A HREF="./3.html">3</A></TD>
|
|
<TD width="8%"><A HREF="./4.html">4</A></TD>
|
|
<TD width="8%"><A HREF="./5.html">5</A></TD>
|
|
<TD width="8%"><A HREF="./6.html">6</A></TD>
|
|
<TD width="8%"><A HREF="./7.html">7</A></TD>
|
|
<TD width="8%"><A HREF="./8.html">8</A></TD>
|
|
<TD width="8%"><A HREF="./9.html">9</A></TD>
|
|
<TD width="8%"><A HREF="./10.html">10</A></TD>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<TD><A HREF="./11.html">11</A></TD>
|
|
<TD><A HREF="./12.html">12</A></TD>
|
|
<TD><A HREF="./14.html">14</A></TD>
|
|
<TD><A HREF="./15.html">15</A></TD>
|
|
<TD><A HREF="./16.html">16</A></TD>
|
|
<TD><A HREF="./17.html">17</A></TD>
|
|
<TD><A HREF="./18.html">18</A></TD>
|
|
<TD><A HREF="./19.html">19</A></TD>
|
|
<TD><A HREF="./21.html">21</A></TD>
|
|
<TD><A HREF="./22.html">22</A></TD>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<TD><A HREF="./23.html">23</A></TD>
|
|
<TD><A HREF="./28.html">28</A></TD>
|
|
<TD><A HREF="./29.html">29</A></TD>
|
|
<TD><A HREF="./30.html">30</A></TD>
|
|
<TD><A HREF="./31.html">31</A></TD>
|
|
<TD><A HREF="./32.html">32</A></TD>
|
|
<TD><A HREF="./33.html">33</A></TD>
|
|
<TD><A HREF="./34.html">34</A></TD>
|
|
<TD><A HREF="./37.html">37</A></TD>
|
|
<TD><A HREF="./38.html">38</A></TD>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<TD><A HREF="./39.html">39</A></TD>
|
|
<TD><A HREF="./41.html">41</A></TD>
|
|
<TD><A HREF="./42.html">42</A></TD>
|
|
<TD><A HREF="./43.html">43</A></TD>
|
|
<TD><A HREF="./44.html">44</A></TD>
|
|
<TD><A HREF="./45.html">45</A></TD>
|
|
<TD><A HREF="./46.html">46</A></TD>
|
|
<TD><A HREF="./47.html">47</A></TD>
|
|
<TD><A HREF="./48.html">48</A></TD>
|
|
<TD><A HREF="./49.html">49</A></TD>
|
|
|
|
</tr></table>
|
|
</P>
|
|
<P> <hr> <P>
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<P> <hr> <P>
|
|
<!-- begin lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<A HREF="../index.html"
|
|
><IMG SRC="../../gx/indexnew.gif" ALT="[ Table Of Contents ]"></A>
|
|
<A HREF="../../index.html"
|
|
><IMG SRC="../../gx/homenew.gif" ALT="[ Front Page ]"></A>
|
|
<A HREF="../lg_bytes37.html"
|
|
><IMG SRC="../../gx/back2.gif" ALT="[ Previous Section ]"></A>
|
|
<A HREF="../york.html"
|
|
><IMG SRC="../../gx/fwd.gif" ALT="[ Next Section ]"></A>
|
|
<!-- end lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
</BODY></HTML>
|
|
<!--endcut ========================================================= -->
|