Score:0

Unit & magnitude of NTP / ntpdate

us flag

I have a cluster of 10 virtualized ubuntu servers. For all of them, I installed the ntp-Daemon. Since I currently running some time sensitive experiments, I am interested in the offsets between my nodes.

I found that the command ntpdate can be used to obtain offsets between the machine clocks. However,running from the first node nodeA0, the command gives:

ubuntu@nodeA0:~$ sudo ntpdate -q nodeA0 nodeA1 nodeA2 nodeA3 nodeA4 nodeA5 nodeA6 nodeA7 nodeA8 nodeA9
server 192.168.1.75, stratum 3, offset -0.000016, delay 0.02570
server 192.168.1.93, stratum 3, offset -0.000190, delay 0.02725
server 192.168.1.245, stratum 3, offset -0.000390, delay 0.02623
server 192.168.1.63, stratum 2, offset -0.000917, delay 0.02646
server 192.168.1.61, stratum 3, offset 0.000015, delay 0.02692
server 192.168.1.107, stratum 2, offset -0.002031, delay 0.02669
server 192.168.1.132, stratum 3, offset -0.000462, delay 0.02655
server 192.168.1.175, stratum 3, offset -0.000317, delay 0.02719
server 192.168.1.92, stratum 3, offset -0.000237, delay 0.02638
server 192.168.1.98, stratum 3, offset -0.000586, delay 0.02786
 1 Feb 10:33:21 ntpdate[3214384]: adjust time server 192.168.1.63 offset -0.000917 sec

My questions:

  1. As the offset gives the clock differences between the machines, I wonder, what unit that is? milliseconds or seconds? In the manpages, I couldn`t find any information regarding that.
  2. Asssuming the unit is milliseconds: Then I would have an offset of 0.016 ms for nodeA1 (the first). This seems too short - I read somewhere that NTP accuracy is in the magnitude of tens of milliseconds.
  3. Did I do anything wrong? Or what would be the optimal way to measure clock differences between two servers?

Edit: The command ntp -qd gives:

ubuntu@nodeA0:~$ ntpq -qn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000
*217.91.44.17    192.168.100.15   2 u   36  256  377   11.388    0.222   0.153
-162.159.200.1   10.100.8.32      3 u   81  128  377    7.829   -0.107   1.089
+80.153.195.191  192.168.100.15   2 u   92  128  377   14.382   -0.056   0.379
+144.76.43.40    213.239.239.164  3 u  109  128  377    7.119    0.331   0.440
-194.35.12.189   131.188.3.220    2 u  108  128  377    5.618   -0.213   0.192
FedKad avatar
cn flag
As far as I know the `ntpdate` command displays times in seconds, while the `ntpq` command in milliseconds. Please, [edit] your question and also paste the output of `ntpq -pn` command. Why don't you use one machine as the primary (internal) NTP server and synchronize all the other machines with this one?
moosehead42 avatar
us flag
I see - could be a way. In that case, I would need to "choose" one server that we use as NTP reference and in all other servers I have probably to set that one in the `etc/ntp.conf`, right? Or is there more todo then?
moosehead42 avatar
us flag
But if the clock differences are so low, as they are displayed, I wouldn`t need any internal NTP server sync, or?
FedKad avatar
cn flag
If I were sensitive to clock synchronization among all my local machines, I would make one machine the primary server (the default configuration as is now is OK) and the rest would synchronize with this primary server (for these machines, edit the `/etc/ntp.conf` file, comment out **all** the `server` and `pool` entries, and put a single `server local_ip_of_your_primary_machine` entry to this file). But, in this case, you should ensure that this "primary machine" is up and running with the NTP daemon all the times.
Christian Ehrhardt avatar
sl flag
As in so many NTP questions I'd like to suggest to switch to chrony nowadays. Not only is it supported, less overhead and often more accurate. You'd usually also get better stats with chronyc (https://chrony.tuxfamily.org/doc/4.2/chronyc.html). I know it would be a bit of re-setup but maybe worth a try. Refs: https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes#Chrony https://ubuntu.com/server/docs/network-ntp https://ubuntu.com/blog/ubuntu-bionic-using-chrony-to-configure-ntp
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.