Link to home
Start Free TrialLog in
Avatar of sysautomation
sysautomation

asked on

ifconfig

Hi

ifconfig command in Linux shows bandwidth usage such has following:

  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:18198145 errors:0 dropped:0 overruns:0 frame:0
TX packets:1948701 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:1211789095 (1.1 GiB)  TX bytes:2354380018 (2.1 GiB)

Open in new window


My question is when this is reset?  I mean it shows download and upload of 1.1 GB and 2.1 GB but from when? From last reboot, last day or since beginning?
Avatar of Manfred Bertl
Manfred Bertl
Flag of Germany image

AFIAK, the counter is reset every time you restart the interface.
Avatar of Dr. Klahn
Dr. Klahn

This is a messy situation, because the counters are kept in the kernel.  There are two cases, only one of which is addressable.

If the network interface is built into the kernel, there's nothing that can be done except a reboot.

If the network interface is a loadable module, it's possible to reset the counters without a reboot -- but -- it's messy and takes networking down briefly.

First find the module name for eth0.

ethtool -i eth0

Open in new window


Assume that eth0 uses the e1000 module.  Write a cronscript to do this little kludge below (hourly, daily, whatever, however often you want the counters reset).

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

Open in new window


I would not use this on anything other than a home machine.  It will take networking down without notice regardless of what the machine is doing.

See also http://askubuntu.com/questions/348038/how-to-reset-ifconfig-counters
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial