#2094 interface config for one interface affects many interfaces

linux
open
nobody
agent (1103)
5
2012-11-08
2009-11-18
Dominik Klein
No

Net-snmp reported the wrong interface speed for a bridge interface (100 vs 1000 mbit).

Here's snmpwalk without an "interface" config in snmpd.conf:

snmpwalk -v 2c -c stats 10.2.50.105 ifspeed
IF-MIB::ifSpeed.1 = Gauge32: 10000000
IF-MIB::ifSpeed.2 = Gauge32: 1000000000
IF-MIB::ifSpeed.3 = Gauge32: 1000000000
IF-MIB::ifSpeed.4 = Gauge32: 1000000000
IF-MIB::ifSpeed.5 = Gauge32: 1000000000
IF-MIB::ifSpeed.6 = Gauge32: 10000000
IF-MIB::ifSpeed.7 = Gauge32: 10000000
IF-MIB::ifSpeed.8 = Gauge32: 10000000
IF-MIB::ifSpeed.50 = Gauge32: 10000000
IF-MIB::ifSpeed.51 = Gauge32: 10000000
IF-MIB::ifSpeed.52 = Gauge32: 10000000
IF-MIB::ifSpeed.53 = Gauge32: 10000000
IF-MIB::ifSpeed.54 = Gauge32: 10000000
IF-MIB::ifSpeed.55 = Gauge32: 10000000
IF-MIB::ifSpeed.56 = Gauge32: 10000000
IF-MIB::ifSpeed.57 = Gauge32: 10000000

snmpwalk -v 2c -c stats 10.2.50.105 ifname
IF-MIB::ifName.1 = STRING: lo
IF-MIB::ifName.2 = STRING: eth1
IF-MIB::ifName.3 = STRING: eth3
IF-MIB::ifName.4 = STRING: eth0
IF-MIB::ifName.5 = STRING: eth2
IF-MIB::ifName.6 = STRING: bond0
IF-MIB::ifName.7 = STRING: br0
IF-MIB::ifName.8 = STRING: virbr0
IF-MIB::ifName.50 = STRING: vnet0
IF-MIB::ifName.51 = STRING: vnet1
IF-MIB::ifName.52 = STRING: vnet2
IF-MIB::ifName.53 = STRING: vnet3
IF-MIB::ifName.54 = STRING: vnet4
IF-MIB::ifName.55 = STRING: vnet5
IF-MIB::ifName.56 = STRING: vnet6
IF-MIB::ifName.57 = STRING: vnet7

The speed of br0 is wrong. That is connected to eth0, which is a gigabit interface. Since br0 is the machines primary interface, it would be nice if I had correct speed.

So I try with interface config:
interface br0 6 1000000000

But unfortunately, this also changes values for eth0-3.

snmpwalk -v 2c -c stats 10.2.50.105 ifspeed
IF-MIB::ifSpeed.1 = Gauge32: 10000000
IF-MIB::ifSpeed.2 = Gauge32: 10000000
IF-MIB::ifSpeed.3 = Gauge32: 10000000
IF-MIB::ifSpeed.4 = Gauge32: 10000000
IF-MIB::ifSpeed.5 = Gauge32: 10000000
IF-MIB::ifSpeed.6 = Gauge32: 10000000
IF-MIB::ifSpeed.7 = Gauge32: 1000000000
IF-MIB::ifSpeed.8 = Gauge32: 10000000
IF-MIB::ifSpeed.50 = Gauge32: 10000000
IF-MIB::ifSpeed.51 = Gauge32: 10000000
IF-MIB::ifSpeed.52 = Gauge32: 10000000
IF-MIB::ifSpeed.53 = Gauge32: 10000000
IF-MIB::ifSpeed.54 = Gauge32: 10000000
IF-MIB::ifSpeed.55 = Gauge32: 10000000
IF-MIB::ifSpeed.56 = Gauge32: 10000000
IF-MIB::ifSpeed.57 = Gauge32: 10000000

snmpwalk -v 2c -c stats 10.2.50.105 ifname
IF-MIB::ifName.1 = STRING: lo
IF-MIB::ifName.2 = STRING: eth1
IF-MIB::ifName.3 = STRING: eth3
IF-MIB::ifName.4 = STRING: eth0
IF-MIB::ifName.5 = STRING: eth2
IF-MIB::ifName.6 = STRING: bond0
IF-MIB::ifName.7 = STRING: br0
IF-MIB::ifName.8 = STRING: virbr0
IF-MIB::ifName.50 = STRING: vnet0
IF-MIB::ifName.51 = STRING: vnet1
IF-MIB::ifName.52 = STRING: vnet2
IF-MIB::ifName.53 = STRING: vnet3
IF-MIB::ifName.54 = STRING: vnet4
IF-MIB::ifName.55 = STRING: vnet5
IF-MIB::ifName.56 = STRING: vnet6
IF-MIB::ifName.57 = STRING: vnet7

brctl show
bridge name bridge id STP enabled interfaces
br0 8000.002219a17e6b no eth0
vnet0
vnet1
vnet2
vnet3
vnet4
vnet5
vnet6
vnet7
virbr0 8000.000000000000 yes

Discussion

  • Dominik Klein
    Dominik Klein
    2009-11-19

    This seems to be a permission problem. If snmpd is run by root, the problem is gone. In my case, it is run with -u nobody.

    When started as nobody with -DmibII/interfaces,9:access:ifcontainer I can see messages like
    mibII/interfaces: ETHTOOL_GSET on eth0 failed
    mibII/interfaces: SIOCGMIIPHY on eth0 failed

    When started as root, these messages are gone and the reported speeds are correct. At least for the physical interfaces. The bridge device still needs manual configuration.

    So to sum up:
    What I described in the first place never was entirely true.

    Run as nobody: Without any interface configuration, the very first query returns good values. As soon as snmpd cycles for the first time (and privileges are dropped), the values for all physical interfaces go wrong. From then, the values stay wrong.
    If there is an interface configuration, that value is used and stays correct after the first cycle.

    Run as root: Without any interface configuration, the physical device's speed is correct, the bridge speed is wrong. When there is an interface configuration for the bridge, both the physical devices and the bridge device's speed is reported correctly.

    Not sure what to set as "status" or "resolution".