Is there any option ntpq for the ntp server connectivity test like the ntpdate -d command?
ntpdate -d ntpserverip
This command shows the suitable ntp server for synchronization. What the equivalent for the ntpq command?
ntpdate -d ntpserverip
adjust time server ntpserverip offset 0.101886 sec –> for success responsentpdate -d ntpserverip
no server suitable for synchronization found –> for fail responseThis ntpserverip is not in the ntp.conf. I want to test different a NTP server which is not in the ntp.conf.
Answer
If you’re missing the deprecated ntpdate
, sntp
is a better substitute than ntpq
.
By default, sntp
ntpserverip
will query the time without setting the clock (like options -q
and -d
of ntpdate
did), using a random port (like options -u
and -d
of ntpdate
did).
Optionally, include:
-4
or-6
to force IPv4 or IPv6 DNS resolution.-d
for debugging mode (may be repeated to increase level).-r
if you need to use NTP port 123 (ifntpd
isn’t already using it).-a
keyid
if you need MAC authentication.
See also:
- Full usage: sntp – Simple Network Time Protocol (SNTP) Client
- Deprecating ntpdate: includes usage equivalences between
ntpdate
,sntp
andntpd
. - Basic NTP client test: ntpdate & sntp: a blog page by Johannes Weber showing sample outputs of both
ntpdate
andsntp
while testing.
Attribution
Source : Link , Question Author : arifisik , Answer Author : Picotin