1
1
I ping a host:
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=47 time=53.8 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=47 time=54.2 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=47 time=49.1 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 49.112/52.401/54.202/2.329 ms
And immediately after interrupting the first ping command, I do it again:
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2016ms
100 % packet loss. Why?
This happens every time. Only by waiting at least 30 seconds (give or take a second) after interrupting the first ping before executing the second ping will the second ping work as it should. Executing ping before the 30 seconds have passed will cause ping to fail (as seen above), even if I let it run past the 30 second mark, but the 30 second "timer" will not be reset.
Pinging different hosts in the first and second attempt changes nothing.
Running tcpdump while pinging, I see that ICMP echoes are sent and that ICMP replies are received in both cases.
I have also reproduced the problem using the Net::Ping Perl module so the problem is not restricted to /bin/ping (unless Net::Ping uses /bin/ping directly).
I use a pretty standard, current Debian installation which runs as a firewall and does NAT using what I would assume are pretty standard iptables rules.
What happens if you don't interrupt the ping? – BillThor – 2011-12-30T19:56:59.007
Whether I interrupt or not seems to make no difference. Running two pings in parallel will produce similar results (the second ping won't work). It's as if the first ping acquires exclusive access to some unique resource required to receive ICMP echo replies. – None – 2011-12-30T21:12:42.770
Might be time to look at the capabilities of
netstat
andlsof
. – BillThor – 2011-12-30T21:18:04.857