How to reset ifconfig counters?

oddone

When i run ifconfig eth0 see following lines:

eth0      Link encap:Ethernet  HWaddr 08:00:27:42:81:a7  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe42:81a7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:66 errors:0 dropped:0 overruns:0 frame:0
          TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:8001 (8.0 KB)  TX bytes:34004 (34.0 KB)

How can i reset these counters especially RX/TX packets?

SuB

Those counters are kept by the kernel, so your answer depends on how your network card driver is built. Two possible choices:

  1. Kernel module
  2. Inside the kernel

If it is second, you can not reset counters without restarting the operating system. If it is first, you can do it by unloading the module from the kernel and then loading it back again. If your NIC card use e1000 module, use following commands:

$ ifconfig eth0 down
$ modprobe -r e1000
$ modprobe e1000
$ ifconfig eth0 up

Use ethtool to find out your NIC module:

$ ethtool -i eth0

In front of driver you see your module name:

driver: e1000
version: 7.3.21-k8-NAPI
firmware-version: 
...

Use apt-get to install ethtool as follow:

$ apt-get install ethtool

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I manually reset RX / TX counters in ifconfig output without impacting data delivery?

How to reset multiple counters with one button in React

Counters increase indefinitely. How to reset?

Unable to reset counters in for loop

Reset AutoInc counters with Slick database

CSS: How to have multiple counters in nested counters

How to divide two Prometheus Counters

How to nest multiple counters in css?

How to use multiple counters in Flink

Trying to make my reset button make counters go to zero

How to get the in/out packets by ifconfig

How to persist an ifconfig setting on macOS

"ifconfig" command gives different output than earlier in Ubuntu 16.04 LTS and eth0 is also missing from the output. How do I reset it?

How to run 3 counters simultaneously in Python?

How to multi-thread two counters in Java?

How to access Hadoop counters values via API?

How to safely compare two unsigned integer counters?

How to disable standard performance counters in Application Insights?

How to align a list of custom-counters?

Python - How to display two counters in for loops

How to count aggregated data and create different counters?

How to use "two" counters in php in a array?

How to combine different counters in one line with SQL

How to find counters of printers through SNMP

How to get Azure SQL performance counters

How to make a row lock for table use as counters?

How to change MTU without ifconfig in ubuntu 18.04?

How to change MTU without ifconfig in ubuntu 18.04?

How to extract "TX packets" from ifconfig