Time synchronization, ntpd?

Time synchronization, ntpd?

Post by John Hei » Thu, 11 Apr 2002 06:46:59



I've been poking around for the past few days looking for docs on how to
get all the machines on my LAN (1 linux box & 2 Winders PCs) to to all
think it's approximately the same time of day.

I *think* I want to run ntpd. I installed it via my RH 7.1 CD but I don't
get any man pages. What's up with that?

So I went to google.com and searched for 'ntpd tutorials' and still can't
make heads or tails out of it. I got my linux box to know what time it is
by saying:

  $ ntpdate ntp3.cs.wisc.edu

I think that if I list that machine as a server in the ntp.conf file, it'll
keep polling it to keep accurate time. But I don't understand how to tell
it how often to poll, for example. None of the tutorials I found explain
how to write a ntp.conf they just give examples -- which is inadequate
because I want to know what the commands *do*.

I didn't get into linux to copy other people's config files.

Well, anmyway, ntpd is running but I can't connect to it from my PC time
setting client. It works vs ntp3.cs.wisc.edu but not vs my linux box. Any
help would be greatly appreciated.

server  ntp3.cs.wisc.edu

server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

driftfile /etc/ntp/drift
multicastclient                 # listen on default 224.0.1.1
broadcastdelay  0.008

authenticate no

 
 
 

Time synchronization, ntpd?

Post by Eric P. McC » Thu, 11 Apr 2002 07:55:52



> I've been poking around for the past few days looking for docs on how to
> get all the machines on my LAN (1 linux box & 2 Winders PCs) to to all
> think it's approximately the same time of day.
> I *think* I want to run ntpd. I installed it via my RH 7.1 CD but I don't
> get any man pages. What's up with that?

The developers of `ntpd' don't seem to think man pages are important.
Debian has a man page, attributed like so:

  AUTHOR


If I remember correctly, Peter runs Debian, so he probably wrote it
specifically for the Debian package.  Email me if you want me to send
you the page, although there's nothing in there not also in the HTML
documentation.

Quote:> So I went to google.com and searched for 'ntpd tutorials' and still can't
> make heads or tails out of it. I got my linux box to know what time it is
> by saying:
>   $ ntpdate ntp3.cs.wisc.edu

Right, you should typically run that right before starting ntpd
(because ntpd has sanity checks that prevent it from skewing your
clock more than 100 seconds or so).

Quote:> I think that if I list that machine as a server in the ntp.conf file, it'll
> keep polling it to keep accurate time.

If by "it" you mean "ntpdate," then no: ntpdate is strictly a one-shot
program.  It runs once and then exits.

Quote:> But I don't understand how to tell it how often to poll, for
> example. None of the tutorials I found explain how to write a
> ntp.conf they just give examples -- which is inadequate because I
> want to know what the commands *do*.

ntpd doesn't exactly work by polling.  That's why you should typically
call ntpdate: ntpd doesn't just blindly update your system clock.  It
instead tries to figure out _how_ your system clock is drifting or
jittering.  It can then use that information to make your system clock
more accurate, assuming it drifts by a predictable amount.  This way
ntpd only needs to make very small corrections: less than 1ms every
five minutes or so.

Part of the reason this is all somewhat fuzzy is that the action of
ntpd is a little fuzzy itself.  For example, I believe ntpd will poll
less frequently if it comes to believe that the system clock is pretty
accurate.

Quote:> I didn't get into linux to copy other people's config files.

Agreed.  I also sympathize with your plight; ntpd is pretty easy for
me _now_, but I too remember wading through pages and pages of highly
technical documents about hardware I don't even have.

Quote:> Well, anmyway, ntpd is running but I can't connect to it from my PC time
> setting client. It works vs ntp3.cs.wisc.edu but not vs my linux box. Any
> help would be greatly appreciated.

ntpq is a good diagnostic tool.  `pe' will show "peers" to the server,
which are those machines ntpd thinks it should use to help calibrate
the system clock.  There is a lot of useful information in that
display.  `as' shows different information about the same machines.
In particular, "condition," "last_event," and "cnt" are all
informative.

Quote:> server  ntp3.cs.wisc.edu

I typically specify _many_ NTP servers.  Obviously, specifying many
_bad_ NTP servers is worse than specifying one good NTP server,
but...

Quote:> server  127.127.1.0     # local clock

I see a lot of people do this, but every authoritative document I've
ever seen advises against it.  My hardware clock skews by about a
quarter of a second overnight, at least according to ntpd.

The rest of your configuration file looks fine.  Moreover, my ntp.conf
has only four lines in it, _all_ of them being good NTP servers.  I
didn't have to touch anything else to get it to work as I wanted.  All
my systems can talk to it just fine.

I would look at your Windows NTP clients.

--

"Last I checked, it wasn't the power cord for the Clue Generator that
was sticking up your ass." - John Novak, rasfwrj

 
 
 

Time synchronization, ntpd?

Post by Wild Wizar » Thu, 11 Apr 2002 10:10:01



> I would look at your Windows NTP clients.

actually i found that windows has in at least the nt series
a built in client in the windows networking code

from a command prompt
net time /setsntp:aaa.bbb.ccc.ddd

--
With careful modifications to the case of the Win 3.1 machine, it can be
hollowed out and turned into a Crab-pot. Once tossed into the nearest river
or estuary, you will be amazed at it's improved performance. Where once it
produced very little of anything, now you'll have mud crabs.

 
 
 

Time synchronization, ntpd?

Post by Eric P. McC » Thu, 11 Apr 2002 10:47:08



> actually i found that windows has in at least the nt series
> a built in client in the windows networking code
> from a command prompt
> net time /setsntp:aaa.bbb.ccc.ddd

I've never been able to get the Windows 2000 NET TIME to work with
ntpd.  It seems to expect to be talking to a Windows 2000 domain
master, which has to provide synchronization because of Kerberos.

--

"Last I checked, it wasn't the power cord for the Clue Generator that
was sticking up your ass." - John Novak, rasfwrj

 
 
 

Time synchronization, ntpd?

Post by Christopher Brown » Thu, 11 Apr 2002 11:42:47



Quote:> I've been poking around for the past few days looking for docs on how to
> get all the machines on my LAN (1 linux box & 2 Winders PCs) to to all
> think it's approximately the same time of day.

> I *think* I want to run ntpd. I installed it via my RH 7.1 CD but I don't
> get any man pages. What's up with that?

> So I went to google.com and searched for 'ntpd tutorials' and still can't
> make heads or tails out of it. I got my linux box to know what time it is
> by saying:

>   $ ntpdate ntp3.cs.wisc.edu

Do that once, at boot time or such, and that brings you to about the
right time.

Quote:> I think that if I list that machine as a server in the ntp.conf
> file, it'll keep polling it to keep accurate time. But I don't
> understand how to tell it how often to poll, for example. None of
> the tutorials I found explain how to write a ntp.conf they just give
> examples -- which is inadequate because I want to know what the
> commands *do*.

The configuration doesn't declare how often to poll; NTP is adaptive,
and backs off, over time, to poll less often once it's convinced the
time is pretty stable.

Quote:> I didn't get into linux to copy other people's config files.

Here's what my config file looks like, with some "why":

# Local hosts on my own LAN that I want to peer to
peer cache
peer dantzig
peer salesman
peer chvatal
peer godel

# Peers can switch-hit, playing as either clients or servers depending
# on how well they figure their stratum is.
# If this host is sitting at stratum 7, and "chvatal" is at stratum 5,
#  "chvatal" will be treated as server; if roles reverse, with local
#  host at 5, and "chvatal" at 7, the local host gets to be the server.

# The local host treats its HW clock as a stratum 10 source
server 127.127.1.1
fudge  127.127.1.1 stratum 10
#  This means that even if I'm totally disconnected, there's _some_
#  time source, albeit one at a low stratum that will be outweighed by
#  anything at higher strata

# Finally, some external sources
server ntlug.org
server time.hex.net
server time.nrc.ca
server eagle.tamu.edu
driftfile /etc/ntp.drift

Quote:> Well, anmyway, ntpd is running but I can't connect to it from my PC
> time setting client. It works vs ntp3.cs.wisc.edu but not vs my
> linux box. Any help would be greatly appreciated.

Just leave it for a while, and let it settle down.  If the box running
ntpd gets left alone for a while, it should sync against the external
server, and decide it's in sync.  Then, and not before, it'll be
willing to provide time services for other hosts.

You can check status of the daemon via:

# echo dmpeers | ntpdc

     remote           local      st poll reach  delay   offset    disp
=======================================================================
 godel.cbbrowne. 192.168.1.13     3 1024  376 0.00002  0.000102 0.03004
 dantzig.cbbrown 5.0.0.0          0 1024    0 0.00000  0.000000 0.00000
.salesman.cbbrow 192.168.1.13     3 1024  377 0.00058  0.027681 0.00795
 chvatal.cbbrown 5.0.0.0          0 1024    0 0.00000  0.000000 0.00000
 time.nrc.ca     192.168.1.13     2 1024  377 0.08228  0.036951 0.01486
*eagle.tamu.edu  192.168.1.13     2 1024  377 0.09692  0.028941 0.01532
 chvatal.cbbrown 5.0.0.0          0 1024    0 0.00000  0.000000 0.00000

The key to it running well is for the final column, "displacement," to
fall to low values.  Once the values fall to a few thousandths of a
second, which typically takes some minutes to settle, one or another
server will be treated as what it's syncing against.  At the moment,
that's eagle.tamu.edu, marked with the "*".  salesman, marked with
".", is apparently the second best server being synced against.  (It's
on a local Ethernet, which is good; it's merely my laptop, which is
slightly less good...)

Alternatively:
# ntpq
ntpq> lpeers
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 dantzig.cbbrown 0.0.0.0          0 u    - 1024    0    0.000    0.000 4000.00
+salesman.cbbrow cudns.cit.corne  3 u  217 1024  377    0.588   27.681   8.305
 chvatal.cbbrown 0.0.0.0          0 u    - 1024    0    0.000    0.000 4000.00
*eagle.tamu.edu  dns.tamu.edu     2 u  739 1024  377   96.929   28.941   0.101
-masq.hyperusa.c 204.34.198.40    2 u  893 1024  377  143.148   -8.904   1.412
-time.nrc.ca     tac.nrc.ca       2 u 1020 1024  377   82.277   36.951  35.663
 chvatal.cbbrown 0.0.0.0          0 u    - 1024    0    0.000    0.000 4000.00
+dense.utcc.utor ntp2.usno.navy.  2 u  781 1024  377   66.295   31.767  33.097
ntpq>

This is arguably a bit more readable; the refid indicates that the
various hosts that I'm querying are, themselves, querying other hosts.
--

http://www.ntlug.org/~cbbrowne/spreadsheets.html
Rules of the Evil Overlord #219. "I will be selective in the hiring of
assassins.   Anyone who  attempts to  strike down  the hero  the first
instant his back is turned will not even be considered for the job."
<http://www.eviloverlord.com/>

 
 
 

Time synchronization, ntpd?

Post by Steve Cowle » Thu, 11 Apr 2002 14:25:31





> > actually i found that windows has in at least the nt series
> > a built in client in the windows networking code
> > from a command prompt
> > net time /setsntp:aaa.bbb.ccc.ddd

> I've never been able to get the Windows 2000 NET TIME to work with
> ntpd.  It seems to expect to be talking to a Windows 2000 domain
> master, which has to provide synchronization because of Kerberos.

I have my W2K systems sync'ing to ntpd on my linux box. No kerberos here.

It's been awhile since I configured this, but...

1) From a command prompt: net time /setsntp:192.168.9.1
   192.168.9.1 is my ntpd server, replace with the ip address of your ntpd
server.
2) From a command prompt: net time /querysntp (to verify)
3) To test: w32tm -test -v
4) Enable/Start "Windows Time" service.

That's all I did.

NOTE: If I do not "setsntp" to a valid ip (its null), then w32tm will
display that it is trying to locate a DC on my network. Which fails in my
case.

Steve Cowles
remove the _ to reply

 
 
 

Time synchronization, ntpd?

Post by rnich.. » Thu, 11 Apr 2002 12:16:51




:I've been poking around for the past few days looking for docs on how to
:get all the machines on my LAN (1 linux box & 2 Winders PCs) to to all
:think it's approximately the same time of day.
:
:I *think* I want to run ntpd. I installed it via my RH 7.1 CD but I don't
:get any man pages. What's up with that?
[SNIP]

You should find that useful information got installed in HTML form.  Point
your browser at file:/usr/share/doc/ntp-4.0.99k/index.htm .

--

 
 
 

Time synchronization, ntpd?

Post by Bill Unr » Fri, 12 Apr 2002 03:41:23




]> I've been poking around for the past few days looking for docs on how to
]> get all the machines on my LAN (1 linux box & 2 Winders PCs) to to all
]> think it's approximately the same time of day.
]>
]> I *think* I want to run ntpd. I installed it via my RH 7.1 CD but I don't
]> get any man pages. What's up with that?

ls /usr/share/doc/xntp*

Should be more than enough documentation.

]>
]> So I went to google.com and searched for 'ntpd tutorials' and still can't
]> make heads or tails out of it. I got my linux box to know what time it is
]> by saying:
]>
]>   $ ntpdate ntp3.cs.wisc.edu

That is a one time check. Use xntpd for a daemon that keeps your system
on track.

]> I think that if I list that machine as a server in the ntp.conf
]> file, it'll keep polling it to keep accurate time. But I don't
]> understand how to tell it how often to poll, for example. None of
]> the tutorials I found explain how to write a ntp.conf they just give
]> examples -- which is inadequate because I want to know what the
]> commands *do*.

REad the documentation.

I like chrony better as it will also keep track of your real time clock
and on bootup you can use it, and have chrony correct it for how much
the RTC clock is out and by how fast or slow it runs, and set up pretty
close to the correct time on bootup (chronyd -r -s)
xntp does not do that. If you leave your machine on all the time, this
feature is not so important. If you do not, it is important.

 
 
 

Time synchronization, ntpd?

Post by Villy Kru » Fri, 12 Apr 2002 15:58:50


On 10 Apr 2002 18:41:23 GMT,

Quote:

>I like chrony better as it will also keep track of your real time clock
>and on bootup you can use it, and have chrony correct it for how much
>the RTC clock is out and by how fast or slow it runs, and set up pretty
>close to the correct time on bootup (chronyd -r -s)
>xntp does not do that. If you leave your machine on all the time, this
>feature is not so important. If you do not, it is important.

Also, chrony would work better over a dial-up link as you can turn it
offline for most of the time.  When you then turn it on for about
15 minutes every day it will sync enough to both ajust the time and
adjust the clock to run more accurately.  I just a crontab script
for this.

Villy

 
 
 

Time synchronization, ntpd?

Post by Juha Laih » Mon, 15 Apr 2002 19:25:59




>> I've been poking around for the past few days looking for docs on how to
>> get all the machines on my LAN (1 linux box & 2 Winders PCs) to to all
>> think it's approximately the same time of day.

>> I *think* I want to run ntpd. I installed it via my RH 7.1 CD but I don't
>> get any man pages. What's up with that?

Others have already told you where to find the documentation; one more
thing to help you locate documentation in the future. F.ex., with ntpd,
you've found out that there's a binary /usr/sbin/ntpdate. First, determine
which rpm package contains this binary:


ntp-4.1.0-4

Then, based on this information, list all files in this package:

... and look if there are any file names that might look like documentation.

Quote:>>   $ ntpdate ntp3.cs.wisc.edu

>Do that once, at boot time or such, and that brings you to about the
>right time.

And to have a "permanent" time synchronisation (DON'T DO THIS if you're
on a pay-per-minute dialup!):
/sbin/chkconfig --levels 2345 ntpd on
/etc/rc.d/init.d/ntpd start

The first command will modify your system startup so that in the
future ntpd (ntp daemon, a background program that keeps your machine
synchronised with the outside world) will be automatically started when
your machine starts up. The second one will start the ntpd (chkconfig
doesn't force a service to start immediately; it will just be enabled
for future reboots).

Quote:>Here's what my config file looks like, with some "why":

># Local hosts on my own LAN that I want to peer to
>peer cache

... my preference is to have a more rigid hierarchy of NTP servers;
time synchronisation definitely is one thing I want to keep as constant
as possible.

Quote:># The local host treats its HW clock as a stratum 10 source
>server 127.127.1.1
>fudge  127.127.1.1 stratum 10
>#  This means that even if I'm totally disconnected, there's _some_
>#  time source, albeit one at a low stratum that will be outweighed by
>#  anything at higher strata

As it's rather easy to have a machine at stratum 5 when relying on
external sources, I'd recommend having at least one machine within
your network fudging its internal clock to stratum 7 or 8. Stratum
10 (as above) means that no-one will believe this internal clock,
so if the network loses its internet connection, all machines will
revert to their own clocks. With one time server at a non-10 stratum
will have other machines in the network to at least synchronise with
that one machine.

Quote:># Finally, some external sources
>server ntlug.org
>server time.hex.net
>server time.nrc.ca
>server eagle.tamu.edu
>driftfile /etc/ntp.drift

... consider adding "prefer" to one of those sources. I used to be in
the situation where I had two external time sources; both claiming to
provide st3 time - and still having couple of seconds difference in the
time they provided. The ntpd on my machine couldn't decide which one to
trust more, and kept oscillating between the two. Adding "prefer" to one
of the time sources helped the situation so that the other time source
was used only when the preferred was not available.

Quote:>You can check status of the daemon via:
...
># ntpq
>ntpq> lpeers
>     remote           refid      st t when poll reach   delay   offset  jitter
>==============================================================================
> dantzig.cbbrown 0.0.0.0          0 u    - 1024    0    0.000    0.000 4000.00
>+salesman.cbbrow cudns.cit.corne  3 u  217 1024  377    0.588   27.681   8.305
> chvatal.cbbrown 0.0.0.0          0 u    - 1024    0    0.000    0.000 4000.00

... and to explain some fields here;
- "when" tells how many seconds have passed since the server was last
  reached ("-" meaning that the currently running ntpd has never been
  able to contact that server
- "reach" is a bitmap (in octal format) telling the status of last 8
  attempts to contact the server; 377 means the server has been
  reachable for them all, 0 means that last 8 attempts have failed.
  376 would mean the latest attempt had failed, 375 that the latest
  attempt was fine, but the one before that had failed, and so on.
- "poll" tells how often this server is currently polled (interval in
  seconds)
--
Wolf  a.k.a.  Juha Laiho     Espoo, Finland

         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
 
 

1. time synchronization ('timed')

I just got my first Linux (Red Hat Intel 4.0 running on a P100)
(extremely cool).  I am connected to the net via an Ethernet card,
and I am trying to set my clock as a slave from another machine on the
net.   I found the 'timed' command, and I also saw a lot of info
related to xntp.   As I don't need super-accuracy, I thought
that using timed would be less painful (enough to keep the clock
in 'shape').   So I tried

But it didn't do any good. It gives me back:

I don't have much of a clue for what I should do to get timed
to do what I want....

 Also, I understand that I should put it somewhere to restart at every
'reboot'. Would that be 'rc.local' ????

Any help will be appreciated.

Thanks,
Carlos

2. Routing problem?

3. Time synchronisation using timed

4. Compaq NIC and also Mach64

5. Time synchronization between AIX machines using 'timed'.

6. which 4 mb s3/virge (/vx ?) video card for x ??

7. ntpd not adjusting time

8. RAID

9. ntpd will not set my machines date/time

10. System time syncs then drifts with NTPD running

11. ntpd - real time?

12. Time (NTPd) syncronisation from WinXP clients

13. is ntpd hitting my time servers every 20 minutes?