0

下午好,

我正在使用三台计算机(在 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

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

最好的问候, Sonsolès

4

2 回答 2

2

您可以使用 -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.
于 2013-08-14T12:26:39.607 回答
0

我猜你能 -O

ping -O host.com

claudionei@TI-03 ~ $ ping -O 10.251.15.251
PING 10.251.15.251 (10.251.15.251) 56(84) 字节数据。
来自 10.251.15.251 的 64 字节:icmp_seq=1 ttl=62 时间=4.50 毫秒
icmp_seq=2 尚无答案
来自 10.251.15.251 的 64 字节:icmp_seq=2 ttl=62 时间=1950 毫秒
icmp_seq=3 尚无答案
64 字节来自 10.251.15.251:icmp_seq=3 ttl=62 时间=1409 毫秒
64 字节来自 10.251.15.251:icmp_seq=4 ttl=62 时间=576 毫秒
64 字节来自 10.251.15.251:icmp_seq=5 ttl=62 时间=654 毫秒
64来自 10.251.15.251 的字节:icmp_seq=6 ttl=62 time=4.41 ms

--- 10.251.15.251 ping 统计 ---
6 个数据包传输,6 个接收,0% 数据包丢失,时间 5001ms
rtt min/avg/max/mdev = 4.416/766.491/1950.291/710.053 ms,管道 2

于 2015-09-18T20:52:37.047 回答