Support Center > Search Results > SecureKnowledge Details
How to reset interface counters Technical Level
Solution

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:

  1. Connect to the machine over console (to avoid a situation in which you could be disconnected from the machine).

  2. 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
    driver: r8169
    version: 2.3LK-NAPI
    firmware-version:
    bus-info: 0000:03:00.0

    In the above example, the driver/module name is: r8169

  3. Unload the driver. Run: modprobe -r driver_name

  4. Re-load the driver. Run: modprobe driver_name

  5. Force the interfaces back-up. Run: ifup interface_name

  6. 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

     

Give us Feedback
Please rate this document
[1=Worst,5=Best]
Comment