How do I test connection to a ntp server?

219 篇文章 2 订阅

 

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 4.2.4p8@1.1612-o 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值