The interface counters/statistics is the information contained in the output of the "ifconfig" or "cat /proc/net/dev" command. This information refers to the bytes/packets sent/received by the interface, collisions, errors, dropped packets, etc.
To reset the interface counters/statistics without rebooting the machine, it is necessary to unload the network module (driver) for the network card and re-load it.
Important Note: If multiple cards are using the same module, then all cards will be out-of-service until the module is loaded. That is, these cards will not pass any traffic until the module is re-loaded! This is because of Linux design - traffic counters are reset only when the interface device is reset.
To reset the counters/stats:
- Connect to the machine over console (to avoid a situation in which you could be disconnected from the machine).
- Find out which network module is being used by the network card.
Run: ethtool -i interface_name
The output is similar to this:
root:~$ ethtool -i eth1
In the above example, the driver/module name is: r8169
- Unload the driver. Run: modprobe -r driver_name
- Re-load the driver. Run: modprobe driver_name
- Force the interfaces back-up. Run: ifup interface_name
- Run ifconfig to make sure that all interfaces are up and running.
If you do not see a specific interface in the list, make sure to run: ifup interface_name