Ping超时问题

时间:2013-08-14 10:10:30

标签: linux networking ubuntu timeout ping

下午好,

我正在使用三台计算机(在Linux Mint 14下)LAN。它们连接到交换机,没有任何防火墙。 问题在于,他们中的每一个都很难检测到其中一个同伴的失败。

例如,我继续进行测试: 我从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

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

祝你好运, Sonsoles酒店

2 个答案:

答案 0 :(得分: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.

答案 1 :(得分: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 time = 4.50 ms
  还没有回答icmp_seq = 2
  来自10.251.15.251的64字节:icmp_seq = 2 ttl = 62 time = 1950 ms
  还没有回答icmp_seq = 3
  来自10.251.15.251的64字节:icmp_seq = 3 ttl = 62时间= 1409 ms
  来自10.251.15.251的64字节:icmp_seq = 4 ttl = 62 time = 576 ms
  来自10.251.15.251的64字节:icmp_seq = 5 ttl = 62时间= 654 ms
  来自10.251.15.251的64字节: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