[ntp:questions] NTPQ -P shows both IP and DNS name (parsing problem)

roman.mescheryakov at gmail.com roman.mescheryakov at gmail.com
Tue Jun 20 13:55:19 UTC 2017


Hello everyone, 
The software developed by me uses ntpq -p to periodically (every 10 seconds) check ntpd time syncing status. ntpq output is parsed and fields “peer”, “refid” and “offset” are extracted by index. This works fine until some strange peer appears in the list for which both IP and DNS name are returned:
 
             remote           refid      st t when poll reach   delay   offset  jitter
        ==============================================================================
         0.debian.pool.n .POOL.          16 p    -    8    0    0.000    0.000   0.002
         1.debian.pool.n .POOL.          16 p    -    8    0    0.000    0.000   0.002
         2.debian.pool.n .POOL.          16 p    -    8    0    0.000    0.000   0.002
         3.debian.pool.n .POOL.          16 p    -    8    0    0.000    0.000   0.002
         LOCAL(0)        .LOCL.          10 l   32    8   10    0.000    0.000   0.002
        *193.11.114.43 ( 75.17.28.47      2 u    8    8    7   29.118   -0.185   2.276
         5.20.0.20       193.219.61.110   2 u    7    8    7   82.714    0.315   0.717
        -Time100.Stupi.S .PPS.            1 u    8    8    7   29.916   -2.316   2.894
        +ntp2.ivlan.net  194.190.168.1    2 u    8    8    7    5.426   -0.772   2.666
        +ntp1.ivlan.net  194.190.168.1    2 u    8    8    7    8.840    0.888   1.217
         bagnikita.com   89.109.251.24    2 u    1    8    7    7.504   -1.115   1.227
         78.140.251.2    194.190.168.1    2 u    1    8    7   14.441    0.937   1.559
         mx2.volgaship.c 131.188.3.223    2 u   10    8    3   13.515   -0.317   0.939
 
See the line starting with “*193.11.114.43 (“
 
If I run “ntpq -pw”, then the output is the following:
 
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.debian.pool.ntp.org
                 .POOL.          16 p    -    8    0    0.000    0.000   0.002
 1.debian.pool.ntp.org
                 .POOL.          16 p    -    8    0    0.000    0.000   0.002
 2.debian.pool.ntp.org
                 .POOL.          16 p    -    8    0    0.000    0.000   0.002
 3.debian.pool.ntp.org
                 .POOL.          16 p    -    8    0    0.000    0.000   0.002
 LOCAL(0)        .LOCL.          10 l   58    8  200    0.000    0.000   0.002
-193.11.114.43 (tor1.mdfnet.se)
                 75.17.28.47      2 u    4    8   77   32.737    1.864   0.675
-5.20.0.20       193.219.61.110   2 u    3    8   77   84.743   -0.631   0.543
*Time100.Stupi.SE
                 .PPS.            1 u    4    8   77   30.945    1.135   1.137
+ntp2.ivlan.net  194.190.168.1    2 u    4    8   77    9.237    1.225   0.860
+ntp1.ivlan.net  194.190.168.1    2 u    4    8   77    9.085    1.165   1.026
-bagnikita.com   89.109.251.24    2 u    7    8   37    7.879   -0.385   0.591
+78.140.251.2    194.190.168.1    2 u    7    8   37   14.324    0.418   1.500
-mx2.volgaship.com
                 131.188.3.223    2 u    6    8   37   13.515   -0.317   1.479
 
See the line starting with “-193.11.114.43 (tor1.mdfnet.se)”
 
This strange peer breaks extracting fields by index. For the above example it extracts “(“ as “refid” value instead of “75.17.28.47” and “29.118” as “offset” value instead of “-0.185”.
 
ntpq version is 4.2.8p10 at 1.3728-o Mon May  8 10:30:41 UTC 2017 (1)
 
Is this behaviour a bug or a feature?

Kind regards, Roman Mescheryakov



More information about the questions mailing list