Interface alias statistics
Interface aliases and ifTable statistics
Note: this is a Linux specific page.
Occasionally people will ask us why interface aliases (e.g. eth1:2) do not show up in the ifTable. Invariably, these people want to track bandwidth for these aliases.
Unfortunately, the Linux kernel does not track statistics for aliases, so we don't have an easy way to get the data.
One way to work around this problem is to use iptables to gather statistics. Robert Graf created a script called ipt2mrtg which creates iptables rules for just this purpose. If you really need statistics for aliases, this script plus the extend directive is a quick way to solver your problem.
There is a C API for manipulating iptables rules, so in theory snmp could create these rules at startup and integrate the statistics into the ifTable. The trouble is what to use as the ifIndex, since we don't want to conflict with the kernel's ifIndex values. The best solution is probably a new Net-SNMP mib table which extends the ifTable.
If you would like to tackle this problem and contribute code to manage iptable entries automatically, please submit your code to our patches tracker.