5

For educational purposes I wanted to trace a chain of NTP servers, e.g. 0.de.pool.ntp.org back to a stratum 1 NTP server. How can I do this?


I found ntptrace, but it doesn't work:

/home/xyzdragon# ntptrace
localhost: stratum 2, offset -0.009285, synch distance 0.010221
192.53.103.104: timed out, nothing received
***Request timed out

I tried to debug /usr/bin/ntptrace by reproducing the steps of that Perl-script manually:

home/xyzdragon# ntpq -n
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+78.47.249.19    56.1.129.236     3 -  129  128  376   27.339   14.405  12.857
ntpq> host 78.47.249.19
current host set to 78.47.249.19
ntpq> pe
78.47.249.19: timed out, nothing received
***Request timed out

Actually ntptrace uses a combination of rv and pstat instead of the pe ntpq command.

After several tries getting it to work with ntpq, I just used a workaround:

  1. Read peer and refid from `ntpq -p
  2. Insert server 56.1.129.236 (skipping 78.47.249.19) into /etc/ntp.conf
  3. Apply settings with sudo service ntp restart
  4. Go to 1.

This works to trace an NTP chain, but it is very tedious. My questions therefore are:

  • How can I use maybe ntpq only to trace the NTP server chain?
  • Why isn't ntptrace working in the first place?
2

From the man page of ntptrace:

ntptrace is a perl script that uses the ntpq utility program to follow the chain of NTP servers from a given host back to the primary time source. For ntptrace to work properly, each of these servers must implement the NTP Control and Monitoring Protocol specified in RFC 1305 and enable NTP Mode 6 packets.

  • And the unstated bit is that very few, if any, NTP servers will allow management queries from random IP addresses on their public interfaces. The NTP pool project specifically states to disable management queries on the IP address used for NTP pool time queries. – tgharold Jun 14 '15 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.