linux - Ping 超时问题

标签 linux networking ubuntu timeout ping

<分区>

下午好

我在三台计算机(在 Linux Mint 14 下)局域网上工作。它们连接到交换机,并且都没有任何防火墙。 问题是它们中的每一个都非常慢地检测到其中一个同行的故障。

例如,我继续进行该测试: 我从 192.168.0.2 ping 到 192.168.0.3。 10 秒后,我从开关上拔下 192.168.0.3...问题是 192.168.0.2 需要 48 秒才能检测到! 在这里您会找到该测试的日志

oneadmin@192.168.0.2 ~ $ ping -v -i 1 192.168.0.3
PING 192.168.0.3 (192.168.0.3) 56(84) bytes of data.
64 bytes from 192.168.0.3: icmp_req=1 ttl=64 time=0.233 ms
64 bytes from 192.168.0.3: icmp_req=2 ttl=64 time=0.236 ms
64 bytes from 192.168.0.3: icmp_req=3 ttl=64 time=0.220 ms
64 bytes from 192.168.0.3: icmp_req=4 ttl=64 time=0.229 ms
64 bytes from 192.168.0.3: icmp_req=5 ttl=64 time=0.233 ms
64 bytes from 192.168.0.3: icmp_req=6 ttl=64 time=0.210 ms
64 bytes from 192.168.0.3: icmp_req=7 ttl=64 time=0.271 ms
64 bytes from 192.168.0.3: icmp_req=8 ttl=64 time=0.273 ms
64 bytes from 192.168.0.3: icmp_req=9 ttl=64 time=0.291 ms
64 bytes from 192.168.0.3: icmp_req=10 ttl=64 time=0.201 ms
From 192.168.0.2 icmp_seq=58 Destination Host Unreachable
From 192.168.0.2 icmp_seq=59 Destination Host Unreachable
From 192.168.0.2 icmp_seq=60 Destination Host Unreachable
From 192.168.0.2 icmp_seq=61 Destination Host Unreachable
From 192.168.0.2 icmp_seq=62 Destination Host Unreachable
From 192.168.0.2 icmp_seq=63 Destination Host Unreachable
From 192.168.0.2 icmp_seq=64 Destination Host Unreachable
From 192.168.0.2 icmp_seq=65 Destination Host Unreachable
From 192.168.0.2 icmp_seq=66 Destination Host Unreachable
From 192.168.0.2 icmp_seq=67 Destination Host Unreachable
From 192.168.0.2 icmp_seq=68 Destination Host Unreachable
From 192.168.0.2 icmp_seq=69 Destination Host Unreachable

我该怎么做才能减少那个时间?

最好的问候, 松露

最佳答案

可以使用-w来指定超时时间

ping -c1  -w1 192.168.0.3

选项详细信息:

-c count

                  Stop  after  sending  count  ECHO_REQUEST packets. With deadline option, ping
                  waits for count ECHO_REPLY packets, until the timeout expires.


-w deadline
                      Specify a timeout, in seconds, before ping exits regardless of how many pack‐
                      ets  have  been sent or received. In this case ping does not stop after count
                      packet are sent, it waits either for deadline expire or  until  count  probes
                      are answered or for some error notification from network.

关于linux - Ping 超时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18228886/

相关文章:

java - CentOS 7 上的 Tomcat 8 管理器访问被拒绝(错误 403)而不提示输入登录名/密码

Java + UDP + DatagramSocket : Why is a PortUnreachableException thrown, 当 UDP 被设计为无连接时?

linux - 如何为命令而不是文本着色?

python - 使用 pip 安装包时出现 ssl 错误

database - 为什么要把IP转成整数来存储呢?

ios - 如何将 Ubuntu 上的 Ionic 项目导出到 iOS?

linux - 根据重复行值拆分文本文件的内容

linux - 优化 bash 脚本(for loops, permissions, ...)

linux - Docker 不会将文件从容器复制到主机的/tmp 文件夹

java - 计算网络下载速度