ntpq 命令返回“timed out, nothing received”的排查方法

简介: 开启Ipv6网络,ecs 执行ntpq 查询超时的排查过程

问题现象

多台ecs实例机器都能通过ntpq -p命令查看时间同步情况,只有其中一个实例使用ntpq -p命令的时候出错:

localhost: timed out, nothing received

***Request timed out

aeb65a4b756fd466454e2d10a09eeb5bebf0f4d8

排查过程

1.分析对比了正常和非正常显示的主机中/etc/ntp.conf的配置文件,结果相同,排除ntp命令本身以及配置的问题

2.直接通过strace  ntpq -p 查看命令执行过程如下

d079b650de03b270feb0375bd9c427f97379830a

结果显示,AF_INET6 即IPv6 地址向外发送sendto数据超时
推测这台主机有启用Ipv6 ,默认先走的ipv6地址

验证过程

ntpq -p 如果不指定地址的话,走的是默认ntp server

1.手动指定地址,正常显示

2. ntp -4p 即指定通过ipv4 地址获取返回值,正常显示

3.ntpq  -6p  指定通过ipv6 地址获取返回值,显示和ntpq  -p 命令返回“timed out, nothing received”的结果一致
d90ef6d578f3665e17a3b319c82534ae45756fa4


通过分析对比测试
因为开启了Ipv6 ,默认ntpq 先走Ipv6的通道,而ECS  linux 默认无法直接访问ipv6地址,因此会访问超时


解决方案

关闭Ipv6 后,再重新执行ntpq -p 显示正常

临时关闭开启Ipv6的方法如下

interface-name 为eth0/eth1


 sh -c 'echo 1 > /proc/sys/net/ipv6/conf/<interface-name>/disable_ipv6'   #关闭  
 sh -c 'echo 1 > /proc/sys/net/ipv6/conf/<interface-name>/disable_ipv6'   #开启
或者关闭所有接口(包括回环接口)的Ipv6 地址
 sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6'

永久关闭ipv6

/etc/sysctl.conf  中添加如下参数

# 禁用整个系统所有接口的IPv6
net.ipv6.conf.all.disable_ipv6 = 1
# 禁用某一个指定接口的IPv6(例如:eth0, eth1)
net.ipv6.conf.eth1.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1





目录
相关文章
|
25天前
|
Java
【Azure 事件中心】向Event Hub发送数据异常 : partitionId[null]: Sending messages timed out
【Azure 事件中心】向Event Hub发送数据异常 : partitionId[null]: Sending messages timed out
接口返回aop.unknow-error,系统繁忙
创建门店返回aop.unknow-error,大多数是因为传入的门店详细地址、店铺经纬度、省市区号指向的不是同一个地点而造成的,出现此类问题时,ISV需要首先核对上述地址是否指向相同地方,经纬度是否填反,是否没有使用高德坐标系,省市区号是否不是国标,是否填错。
1203 0
|
3月前
|
弹性计算 监控 Serverless
函数计算操作报错合集之调用不成功,报错:Function instance health check failed on port 9000 in 120.7 seconds.该怎么办
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
|
2月前
|
Serverless 应用服务中间件 网络安全
函数计算操作报错合集之如何处理报错 "Function instance health check failed on port 7860 in 120 seconds."
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
错误: 实例 "ahwater-linux-core" 执行所请求操作失败,实例处于错误状态。: 请稍后再试 [错误: Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance 7c1609
错误: 实例 "ahwater-linux-core" 执行所请求操作失败,实例处于错误状态。: 请稍后再试 [错误: Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance 7c1609c9-9d0f-4836-85b3-cefd45f942a7.
5453 0
|
4月前
|
Windows
如何在关闭socket连接的时候跳过TIME_WAIT的等待状态
如何在关闭socket连接的时候跳过TIME_WAIT的等待状态
|
消息中间件 网络架构
OpenStack报错:MessagingTimeout: Timed out waiting for a reply to message ID
OpenStack报错:MessagingTimeout: Timed out waiting for a reply to message ID
1312 0
|
网络协议
排错-tcpreplay回放错误:send() [218] Message too long (errno = 90)
排错-tcpreplay回放错误:send() [218] Message too long (errno = 90)
205 0
|
Python
pip 安装库失败问题:Retrying (Retry(total=4, connect=None, read=None, redirect=None, status =None)),原因及解决办法
pip 安装库失败问题:Retrying (Retry(total=4, connect=None, read=None, redirect=None, status =None)),原因及解决办法
16143 0