Is there any utility for performing ICMP testing ("ping") in only one direction?
tcpdump
can do this, and is available pretty much everywhere:
tcpdump -n -i enp0s25 icmp
will dump all incoming and outgoing ICMP packets on enp0s25
.
To see only ICMP echo requests:
tcpdump -n -i enp0s25 "icmp[0] == 8"
(-n
avoids DNS lookups, which can delay packet reporting and introduce unwanted traffic of their own.)
This allows you to find if it is receiving the packets from the other machine (from which you would e.g. ping
it), so the problem is with the return path, or if they directly don't arrive.
Apart from @Stephen Kitt's suggestion you can run tcpdump
to filter a packet in one direction only:
# see if the icmp request exits the interface
tcpdump -nQ out 'icmp'
tshark
is another useful tool you can use and it doesn't require you to run as root:
tshark -nf "icmp && (icmp[icmptype] == icmp-echo)"
aparte packet capture you can parse the output of
netstat -s
which prints a statistics for each network socket, an example would be the following:
netstat -s | grep -Eo "^[[:space:]]+[[:digit:]]+ ICMP messages sent$"; 1>/dev/null ping -c1 -w1 host; !-1
28 ICMP messages sent
30 ICMP messages sent