I am troubleshooting a latency network issue on a network. It is probably a nic or cabling issue, but while I was going through the process of figuring it out, I was looking at the timings of a ping packet leaving a network card and arriving at another server. Both linux.

So I have tcpdump running on both, and I issue a ping from one to the other, and back again, and looking at the timing differences might have shed light on where the latency is coming from.

It is an academic exercise now, as I need to eliminate some more fundamental causes, but I was curious as to how this could be achieved. Given that ntpd is installed and running on two servers, how can I confirm the current time discrepency between the two servers, to whatever level of accuracy is possible - given that we are talking about latency on a local lan, which is ideally a millisecond or so.

NTP itself is accurate to a couple of ms under good conditions, and as both servers are in the same environment, they should (presumably) achieve a similar level of accuracy, and so should have a time discrepency between them of a only few ms - but how can I check this?


If the two servers are NTP peers, use

  ntpq -p

Which will show current offsets

Note that NTP takes into account network latency. If you know each server's offset from a common NTP server, that is about as accurate as you can get using standard tools.


I have two unix servers using NTP. Lets see what sort of time they are keeping:

$ sudo /usr/sbin/ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
 hufu.ki.iif.hu    2 u   12   64    1   71.755   -0.073   0.001
 web.puflet.info  3 u   11   64    1   78.248    0.417   0.001     2 u   10   64    1   74.721   -1.076   0.001

$ sudo /usr/sbin/ntpq -p otherbox
     remote           refid      st t when poll reach   delay   offset  jitter
+ntp2.exa-networ    2 u  799 1024  377   43.405    7.796 218.471
+mantaray.netine   3 u  289 1024  377   34.782    8.484 212.631
*rilynn.me.uk     2 u  765 1024  377   45.665    6.804 142.023
+ntp.thirdlight.    2 u  791 1024  377   38.322    9.871 223.397

They are using different servers because they use servers from the ntp pool.

I'll temporarily add otherbox to this server's config so I can directly measure the time offset

$ sudo vi /etc/ntp.conf
 (added `server otherbox`)

$ sudo /sbin/service ntpd restart

$ sudo /usr/sbin/ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
 gamma.h3x.no      3 u    4   64    1   34.840   -0.964   0.001
 web.puflet.info  3 u    3   64    1   78.148   -1.243   0.001
 alpha.rueckgr.a     2 u    2   64    1   61.495   -2.362   0.001
 otherbox.exampl     3 u    1   64    1    0.604  -11.286   0.001

It looks like timestamps on my two servers are about 11 ms different.

| improve this answer | |
  • They aren't, they independently get their time from ntp servers – Paul Apr 5 '12 at 9:40
  • @Paul: See update – RedGrittyBrick Apr 5 '12 at 10:20
  • When you added your local NTP server to the /etc/ntp.conf of the client, I am assuming you did it as such server iburst. Furthermore, did you remove all other servers from the client's list? – puk Nov 13 '13 at 1:30

ntpdate -q does what you want.


root@host1:~# ntpdate -q host2 
server host2, stratum 4, offset 109.584520, delay 0.77560
17 Apr 21:48:16 ntpdate[28849]: no server suitable for synchronization found

In this case, the servers have a difference of about 110 seconds.

| improve this answer | |
  • This does work yes, but the I need some way of getting a quicker response so I can add the offset into a data-collection script. – SJG Jul 9 '15 at 14:54
  • Note: host2 has to be running ntpd. – Curtis Yallop Dec 19 '19 at 18:20

You can also do the following on host1:

root@host1# clockdiff -o host2
| improve this answer | |

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.