Switches, Hubs, and Modems
cancel
Showing results for 
Search instead for 
Did you mean: 

snmp: ifIndex to vlan mapping for internal interfaces?

SOLVED
Go to solution
Martin Dag Nilsson
Occasional Visitor

snmp: ifIndex to vlan mapping for internal interfaces?

Hi,

I'm working on some management scripts using snmp for our Procurve switches. I've run into a problem that I don't seem to find a good solution for...

Example: On our core switch (which is also doing most internal routing) we have a VLAN id 10. The switches interface on this VLAN has IP address 10.0.1.1/24, and seem to have ifIndex 419. However, the dot1qPvid table does not seem to contain the switches internal interfaces, only the physical ports on the switch. So, how can I find these mappings?

Best regards,
/Martin
2 REPLIES
Bruce Campbell_3
Valued Contributor
Solution

Re: snmp: ifIndex to vlan mapping for internal interfaces?


To do this, we use the vlan name, to
cross reference between:

Q-BRIDGE-MIB::dot1qVlanStaticName

and

interfaces.ifTable.ifEntry.ifDescr

(scan all of them in both tables, and
connect them up by name, in an array)

e.g.

Q-BRIDGE-MIB::dot1qVlanStaticName.643 = STRING: as-wifi-v1

IF-MIB::ifDescr.1052 = STRING: as-wifi-v1

This vlan 643 is ifindex 1052, because
the names match. (yes, this is kludgey)

Then, look at all entries in:

IP-MIB::ipAdEntIfIndex

and find the one with value 1052, e.g.

IP-MIB::ipAdEntIfIndex.172.16.6.145 = INTEGER: 1052

and look at:

IP-MIB::ipAdEntNetMask

e.g.

IP-MIB::ipAdEntNetMask.172.16.6.145 = IpAddress: 255.255.255.240

Thus, vlan with tag 643 has ip/mask of
172.16.6.145 / 255.255.255.240

Check in the config, it is correct:

vlan 643
ip address 172.16.6.145 255.255.255.240

Bruce Campbell
Director, Network Services
Information Systems and Technology
MC 1018
(519)888-4567 x38323
University of Waterloo, Waterloo, ON
Martin Dag Nilsson
Occasional Visitor

Re: snmp: ifIndex to vlan mapping for internal interfaces?

Ok, thanks. I figured that you could do it this way, but I was not sure that it was the right way to do it. But now I know. :-)