Debug network traffic on a Linux server

Use the following shell command to print all traffic from and to the given IP:

/usr/sbin/tcpdump -n -i any host 10.254.52.59

This will print something like this:

15:46:29.272434 IP 10.254.52.59 > 10.254.252.237: ICMP echo request, id 1, seq 857, length 40
15:46:29.272469 IP 10.254.252.237 > 10.254.52.59: ICMP echo reply, id 1, seq 857, length 40
15:46:34.265170 IP 10.254.52.59 > 10.254.252.237: ICMP echo request, id 1, seq 858, length 40
15:46:34.265204 IP 10.254.252.237 > 10.254.52.59: ICMP echo reply, id 1, seq 858, length 40
15:46:39.265504 IP 10.254.52.59 > 10.254.252.237: ICMP echo request, id 1, seq 859, length 40
15:46:39.265539 IP 10.254.252.237 > 10.254.52.59: ICMP echo reply, id 1, seq 859, length 40

This can be quite handy if you need to debug network issues.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.