Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 756
  • Last Modified:

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)
  • 3
  • 2
1 Solution
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.
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)
> 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.
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:
          inet6 addr: removed Scope:Link
          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

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

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now