Howto Show/Record Traffic Statistics on subinterfaces under Fedora

I have a few linux servers with multiple subinterfaces for IP addresses, but only 1 physical interface.
I'm trying to find a way to view traffic statistics for these subinterfaces, but /proc/net/dev only shows physical interfaces plus the loopback.

Is it possible to include subinterfaces into /proc/net/dev?
If not, how can I do traffic reporting for subinterfaces? (I want to keep each subinterface separate in the reports)
mtchsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ravenplCommented:
You will not see the subinterfaces traffic. You can group it by src/dts/IP - but not subinterface. The problem is that subinterface name (like eth0:0) is used only for user. Kernel uses the real device to send/receive traffic. One don't even have to create subinterfaces to bind multiple IPs per single NIC.
0
mtchsAuthor Commented:
But why is the traffic statistics lost if it uses the subinterface.

If I look at the traffic stats for eth0, it is not what the system is truely sending/recieving, as I know I'm pushing more than 33 Mb in 30 days, when I upload a constant rate of 15-30 Mbps (albeit on a different subinterface)
0
ravenplCommented:
> But why is the traffic statistics lost if it uses the subinterface.
As I stated before - it is not - subinterface is just alias for userland.
0
mtchsAuthor Commented:
I have a main IP on eth0, that is never used except for system administration, all the rest of the traffic goes to subinterfaces.

eth0 has a send/recv of ~3 GB, when I know for sure that I average 10-20 Mbit/s upload all day every day.
And ~3 GB is not ~50 GB.

So does it just simply not record the traffic?

As shown in the code snippet, ifconfig doesn't show all the usage, but bwm-ng does.
Does /proc/net/dev reset after a certain amount of time?

I have not done any changes to the nic nor has the connection been reset at all for at the very least today.

>One don't even have to create subinterfaces to bind multiple IPs per single NIC.
How do I do that? Everywhere I've looked shows creating a subinterface using ifcfg scripts.


[root@crypt ~]# uptime
 02:16:32 up 30 days,  7:01,  5 users,  load average: 0.48, 0.65, 0.62
[root@crypt ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1C:25:36:AE:F8  
          inet addr:removed  Bcast:removed  Mask:255.255.255.0
          inet6 addr: removed Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3088266641 errors:0 dropped:0 overruns:0 frame:0
          TX packets:210788332 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1209845624 (1.1 GiB)  TX bytes:3403759979 (3.1 GiB)
          Interrupt:50 Base address:0x4800 
 
[root@crypt ~]# 
 
bwm-ng v0.6 (probing every 0.500s), press 'h' for help
  input: libstatnet type: avg (30s)
  |         iface                   Rx                   Tx                Total
  ==============================================================================
               lo:           2.55 Kb/s            2.55 Kb/s            5.10 Kb/s
             eth1:           3.97 Kb/s            4.34 Kb/s            8.31 Kb/s
             eth0:         720.84 Kb/s           12.37 Mb/s           13.08 Mb/s
           venet0:         869.59  b/s            1.26 Kb/s            2.11 Kb/s
  ------------------------------------------------------------------------------
            total:         728.20 Kb/s           12.38 Mb/s           13.09 Mb/s

Open in new window

0
mtchsAuthor Commented:
It looks like the In/Out is a 32bit int... so it wraps at 4 gigs.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.