Today I will be showing you how to check your Linux servers for dropped packets. Dropped packets can occur for a number of reasons including but not limited to, actual network issues, NIC card issues, firmware issues, settings, and more. This will not be a guide on diagnosing why your packets are being dropped, but rather just finding out if it’s even occurring at all.
Checking For Dropped Packets Using “IFCONFIG Command”
The ifconfig command can give you a quick view over your network interfaces, including their network IP, subnet, some packet information, etc. To display all of the information mentioned, drop the grep in my examples and run ifconfig by itself. Note that this command is slowly being replaced by the ip command. I simply listed this first due to habit.
You can also specify whether you would like to just examine one interface or all of your interfaces. In the examples below, I will show you how to check all of your interfaces as-well as checking eth0 specifically.
sudo ifconfig | grep dropped RX packets:535547 errors:0 dropped:0 overruns:0 frame:0 TX packets:522589 errors:0 dropped:0 overruns:0 carrier:0 RX packets:784466 errors:0 dropped:0 overruns:0 frame:0 TX packets:784466 errors:0 dropped:0 overruns:0 carrier:0 sudo ifconfig eth0 | grep dropped RX packets:535456 errors:0 dropped:0 overruns:0 frame:0 TX packets:522515 errors:0 dropped:0 overruns:0 carrier:0
Checking For Dropped Packets Using “IP Command”
You can get the same information by using the ip command although this example will only display your packet information and not any of your network settings such as IP or subnet. Here is an example of checking for dropped packets using the ip command.
ip -s link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 RX: bytes packets errors dropped overrun mcast 642859098 786472 0 0 0 0 TX: bytes packets errors dropped carrier collsns 642859098 786472 0 0 0 0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 46:f6:a9:e3:21:fc brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 282260259 536639 0 0 0 0 TX: bytes packets errors dropped carrier collsns 352637662 523754 0 0 0 0
You can get the information for your configured network interfaces straight from the horses mouth by checking /proc/net/dev.
You can also get a direct answer by running the following command, which will give you both the dropped RX and TX.
If you wish to check RX (received packets) or TX (transmitted packets) separately then run these instead.
cat /sys/class/net/eth0/statistics/rx_dropped cat /sys/class/net/eth0/statistics/tx_dropped
I hope this post has helped you, please let me know if there are any other quick and easy methods that I should of listed. Thanks!