r/linuxadmin • u/xluxeq • Sep 17 '25
Querying time server with ntpq and ntpd, polling single server never works
Hello, I have been stumped at this issue for a long while.
If I ever want to go and test a single ntp server with ntpq, I always get "timed out"
The command I'm using is
ntpq -p x.x.x.x
ntpq -c rv x.x.x.x
Is it completely impossible to test just one server with ntpq?
Should I rely on ntpdate with an IP or ntpq -p without specifying a host or IP address?
ntpd is alive and well though and ntpd -gq works fine
Edit: This is what I'm concluding, and what the man pages mostly imply
when you specify a IP in the ntpq command its running commands on the remote IP and /etc/ntp.conf likely restricts that to localhost and 127.0.0.1 connections
So the remote server has to "allow" that
If you want to test ntp best bet is to stop the ntpd service and run ntpd -gq
And it should receive and update the time
And check the peers with ntpq -p or ntpq -c rv
without an IP specified or specify 127.0.0.1
2
u/kai_ekael Sep 17 '25
man ntpq:
What are you trying to "test"? Why are you passing it an IP? It simply returns the current status of each, so seems like what you're after.
2
u/gmuslera Sep 17 '25
Verify that you have connectivity with the server and service with ntpdate, at least when I played with that long ago was the more straightforward way to check. If that works and gets the right date, then the problem is elsewhere, either configuration, or expectations for it to be instantaneous, bad parameters or configuration or networking problems, to name a few alternatives.
0
u/michaelpaoli Sep 18 '25
Single IP address isn't necessarily single server.
And no guarantees, even if it's perfectly functional NTP server, that you can more generally query it.
Generally no need/reason to stop the NTP service.
You can get basic time information from another NTP server that's generally accessible to you, but no guarantees it will let you have any further information.
So, what the heck is it you're attempting to achieve anyway?
Want good time via NTP, use good NTP server(s), and generally pretty easy to see how well they're performing by looking at your own NTP server. If you're trying to do some other "testing" of other folks NTP server(s), no guarantees they'll comply with or submit to your "testing".
If you've got it reasonably well configured, generally doesn't need mucking with.