9

CentOS 5.9

I'd like to reset the RX/TX counters in ifconfig output for an interface. My understanding is that these counters get reset during a reboot but I'd like to avoid rebooting. Is there another way I can reset that that is non-intrusive to data delivery?

3
  • 3
    I've seen this question before on askubuntu, the answer would be the same for you and can be found here: For short unloading / loading kernel module. But that would be somewhat intrusive to your network. So my guess is that you can't. Commented Nov 11, 2014 at 13:56
  • @a21 agreed. :-/ Commented Nov 11, 2014 at 14:41
  • @a21 If you'd like, feel free to post an answer with that information. Commented Nov 11, 2014 at 15:21

1 Answer 1

5

This has already been answered by @SuB on Ask Ubuntu. I've adapted the answer for CentOS:

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

  • As a kernel module
  • Built into the kernel file itself

In second case, you can not reset counters. In the first case, you can do it by unloading the module from the kernel and then loading it back again. If your NIC card uses the e1000 module, use the following commands:

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

Use ethtool to find out your NIC module:

ethtool -i eth0

After "driver" you see your module name:

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

Use yum to install ethtool as follows:

yum install ethtool
1
  • 1
    You don't need to unload the module. You can unbind and rebind the driver since ~2005. lwn.net/Articles/143397 Commented Jun 24, 2017 at 21:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.