How to reset ifconfig counters
Sometimes it is nice to reset the counters ifconfig displays. This could be done monthly to show detailed bandwidth transfers each month, or after a specific event. To do so, execute the following commands:Determine your network driver by using the following command:
ethtool -i eth0
Execute the command to clear the counters. This command assumes the driver e1000:
modprobe -r e1000; modprobe e1000; ifup eth0
Confirm the command was successful:
ifconfig eth0 | grep bytesRX bytes:1400246 (1.3 MiB) TX bytes:58638 (57.2 KiB)
From the output above, the RX and TX bytes were cleared and only display traffic from the last couple of seconds.
*Disclaimer: Use warning performing these commands if unsure of the proper syntax / variables. Misuse will result in “disconnecting the astronaut” and losing access to the remote host.