How do I test connection to a ntp server?

 

How do I test connection to a ntp server?

 SOLUTION IN PROGRESS - 已更新 2015年十一月3日01:52 - 

English 

環境

  • Red Hat Enterprise Linux
  • ntp

問題

How do I test connection to a ntp server without changing ntp configuration on the client side?

決議

  • Execute the command :-

Raw

ntpq -p
OR
ntpdate -d <ntp server>

If a '*' sign is seen against the NTP server, in the output of the 'ntpq -p' command, it means that ntp client is syncing with that ntp server :-

Raw

[root@node1 ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.122.38  10.16.255.1      2 u    -   16   37    0.165   -0.035   0.018
  • Alternatively, if you'd like to see if your ntp client is capable of receiving ntp related udp traffic, you may execute the below command :-

Raw

[root@node1 ~]# nmap -sU node4 -p 123   ==> port 123 is for NTP and '-sU' is for scanning UDP ports.

Starting Nmap 5.51 ( http://nmap.org ) at 2015-10-29 02:47 IST
Nmap scan report for node4 (192.168.122.38)
Host is up (0.00018s latency).
PORT    STATE SERVICE
123/udp open  ntp
MAC Address: 52:54:00:E7:D2:96 (QEMU Virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
  • If you want to know if at any given instance, the ntp client is able to receive ntp traffic from a ntp source, you may execute the below command :-

Raw

[root@node1 ~]# ntpdate -d node4  ==> Node 4 in this illustration is the ntp server, node1 is the ntp client.
29 Oct 02:46:02 ntpdate[7898]: ntpdate [email protected] Thu Jan 10 15:17:41 UTC 2013 (1)
Looking for host node4 and service ntp
host found : 192.168.122.38
transmit(192.168.122.38)
receive(192.168.122.38)
transmit(192.168.122.38)
receive(192.168.122.38)
..snip..
29 Oct 02:46:02 ntpdate[7898]: adjust time server 192.168.122.38 offset -0.000036 sec

Note :- There could be other ways too but this article is just a heads up for the same. One may find and use other methods as preferable.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章