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

Jakob Bohm jb-usenet at wisemo.com
Wed Jun 21 14:25:05 UTC 2017

On 21/06/2017 13:49, roman.mescheryakov at gmail.com wrote:
> вторник, 20 июня 2017 г., 19:38:53 UTC+3 пользователь David Woolley написал:
>> I think you are expected to use the relevant management request
>> directly, rather than parse output intended for humans.  That would
>> avoid process startup, filtering, and DNS costs.
> What does it mean to “use the relevant management request directly”? I’m new to NTP and Linux and this phrase is not clear to me. If it makes any difference, my program is written on Python and running under Raspbian OS.

ntpq works by sending special "management" request UDP packets to the
queried server and then parsing the resulting "management" reply UDP
packets.  The default is to query the server on (or ::1 for

Some (most?, all?) of these "management" packets are documented in the
NTPv4 protocol RFC.  Their relationships with ntpq command line options
can be found (if nowhere else) in the ntpq source code.

Converting that source code from C to Python is left as an educational
exercise for fans that BBC children's program ;-)


Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

More information about the questions mailing list