How Do I Know Whether NTPD is Working?

Well, after figuring out how to configure NTPD, it appears to be working well: there are two processes running, and there’s a drift file. However, the drift file just has 0.000 in it, and ntpq doesn’t seem to know much:

% ntpq -p
127.0.0.1: timed out, nothing received
***Request timed out

So, how do I know if it’s working? Is it working? Shouldn’t ntpq -p be more informative?

  • E-mail this story to a friend!
  • Sphinn
  • StumbleUpon
  • Facebook
  • del.icio.us
  • LinkedIn
  • TwitThis
  • Digg
  • Google
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • Yahoo! Buzz

Comments & Trackbacks

Thorsten Biel wrote:

Yes, you should be getting something like: # ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *ntp1.NL.net .GPS. 1 u 212 512 377 85.379 -49.419 7.220 +sombrero.cs.tu- .PPS. 1 u 756 512 376 73.458 -35.760 8.022 62.119.40.99 0.0.0.0 16 u - 512 0 0.000 0.000 4000.00 Could it be that port 123/udp is blocked on your host? Have you allowed requests from 127.0.0.1 (and your external time servers) in ntp.conf? -Thorsten

David Wheeler wrote:

Yep

Here's what my ntpd.conf looks like:

restrict default ignore

# syncronize with GS time servers
server pool.ntp.org
server bigben.cac.washington.edu
server time-nw.nist.gov

restrict 128.95.231.7 nomodify nopeer noquery notrap
restrict 128.208.109.7 nomodify nopeer noquery notrap

# local fudge if network servers not available
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

restrict 127.0.0.0 mask 255.0.0.0 nomodify nopeer noquery notrap

# track wander (leading directories will need to exist!)
driftfile /etc/ntp/ntp.drift

Does that allow requests from 127.0.0.1? port 123 is open.

Thanks,

David

Thorsten Biel wrote:

Ah, the "noquery" flag is biting you, remove that from the localhost line, so:
restrict 127.0.0.0 mask 255.0.0.0 nomodify nopeer notrap
You'll also need to add "restrict" lines for each time server you're connecting to (for pool.ntp.org that's quite a few...) BTW, nice blog. :) -Thorsten

David Wheeler wrote:

That was it

Thanks Thorsten, that did the trick. Removing the noquery from the localhost line, I now get:

$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 LOCAL(0)        LOCAL(0)        10 l    -   64    1    0.000    0.000   0.008

Which, I guess, means that it's working.

Hrm, so I guess that the need for restrict lines for all servers is a reason not to use pool.ntp.org?

Cheers,

David

Discussion is now closed.

Powered by KinoSearch