[time-nuts] Tracking NTP displacement and correlation between two clients.
Hal Murray
hmurray at megapathdsl.net
Thu Oct 4 16:46:38 UTC 2012
bownes at gmail.com said:
> Due to reasons I really can't go into, a systems user is concerned with the
> displacement of two servers from the same pair of stratum 2 NTP servers.
> I'm convinced that it really isn an issue as long as the two systems in
> question remain within a few 10's of ms. However, I have no off the shelf
> method of collecting and correlating the data. Before I go out and invent
> the wheel, I thought I would check and see if anyone has done such a thing
> and saved the scripts and whatnot.
Assuming you are running the standard ntpd... It includes all sorts of
logging.
Set up the two systems so they use each other as servers. Turn on rawstats.
ntpd will add a line each time it exchanges a pair of packets with a server.
That line will have the IP Address and 4 time stamps. See the
documentation. Details are in monopt.html The 4 time stamps are:
time the request left the local system
time the request arrived at the remote system
time the response left the remote system
time the response arrived at the local system
If you subtract the first two, you get the network transit time for the
request packet as skewed by the clock offset. Subtracting the last two gives
you the transit time for the response packet.
If you assume the network transit times are equal, you can compute the clock
offset. If you are on a LAN, the transit times will probably be tiny on the
scale of 10s of ms.
(If you assume the clocks are both accurate, you can compute the network
transit time in each direction.)
If you want to graph the results, you have to split out the lines for the
server you are interested in. Then you can feed it to gnuplot/whatever.
You can also do the monitoring from another system, but then you have to sort
out what happens when the clock on that system is off.
How good is your connection to the big bad internet? If you run a big
download over a slow link, the queuing delays can confuse ntp. You might
want to look at the timings from your systems to the stratum-2 servers and/or
from the stratum-2 servers to the outside world.
--
These are my opinions. I hate spam.
More information about the time-nuts
mailing list