# RX/TX bytes in ifconfig resetting?

## ee99ee2

I've noticed that in ifconfig, the RX bytes: and TX bytes: counters reset after so much. I think it's about 3GB when they reset on my Debian box... not sure where they do on my Gentoo desktop, but they do...

Anyone else have this problem? How can it be fixed? Where does ifconfig pull this info from? Somewhere in /proc?

-ee99ee

----------

## Zu`

I'm on FreeBSD here, so I can't really check now, but my guess is you have to look for /proc/net/dev or something similar.

After looking around a bit more,  I also found this:

 *Quote:*   

> 
> 
> the catch here is this: the kernel store the value of bytes transfered
> 
> in a u_int64 data structure (which is the same as long long int) - the
> ...

 

----------

## atac

yeah, they reset after 4 gb

here's a little perl script that get you that info from /proc

```
#!/usr/bin/perl

$packet_in = `cat /proc/net/dev | grep eth0 | awk -F: '/:/ {print \$2}' | awk '{printf \$1}'`;

if($packet_in < 1024**3) { $packet_in = sprintf("%.02f",$packet_in / 1024**2)." Mb"; } else { $packet_in = sprintf("%.02f", $packet_in / 1024**3)." Gb"; }

print $packet_in ."\n";

$packet_out = `cat /proc/net/dev | grep eth0 | awk -F: '/:/ {print \$2}' | awk '{print \$9}'`;

if($packet_out < 1024**3) { $packet_out = sprintf("%.02f",$packet_out / 1024**2)." Mb"; } else { $packet_out = sprintf("%.02f", $packet_out / 1024**3)." Gb"; }

print $packet_out ."\n";

```

----------

## ee99ee2

 *atac wrote:*   

> yeah, they reset after 4 gb

 

 :Mad:   :Mad:   :Mad:   :Mad:   :Mad: 

-ee99ee

----------

