Wednesday, December 5, 2012

How to get vlan usage list via SNMP in Nexus 5000 or 7000


The goal is to get the vlans in use from Cisco Nexus but without having a Layer3 associated with it.

Previously, with IOS, The Layer3 and Layer2 vlans where shown when pooling the mib .iso.3.6.1.2.1.2.2.1.2. With Nexus, using the same mib will only pool the interfaces and Layer3 interfaces (SVIs).

Now, with Nexus, currently it is not possible to pool the vlan table with SNMP.

Currently, in a Nexus 5000, this is the output of the snmpwalk:




snmpwalk -v 1 -c public 10.1.1.1 1.3.6.1.2.1.31.1.1.1.1
IF-MIB::ifName.1 = STRING: Vl1
IF-MIB::ifName.2500 = STRING: Vl2500
IF-MIB::ifName.5001 = STRING: Po1
IF-MIB::ifName.10101 = STRING: Gi0/1
IF-MIB::ifName.10102 = STRING: Gi0/2
IF-MIB::ifName.10103 = STRING: Gi0/3
IF-MIB::ifName.10104 = STRING: Gi0/4
IF-MIB::ifName.10105 = STRING: Gi0/5
IF-MIB::ifName.10106 = STRING: Gi0/6
IF-MIB::ifName.10107 = STRING: Gi0/7
IF-MIB::ifName.10108 = STRING: Gi0/8
IF-MIB::ifName.10109 = STRING: Gi0/9
IF-MIB::ifName.10110 = STRING: Gi0/10
IF-MIB::ifName.10111 = STRING: Gi0/11
IF-MIB::ifName.10112 = STRING: Gi0/12
IF-MIB::ifName.10113 = STRING: Gi0/13
IF-MIB::ifName.10114 = STRING: Gi0/14
IF-MIB::ifName.10115 = STRING: Gi0/15
IF-MIB::ifName.10116 = STRING: Gi0/16
IF-MIB::ifName.10117 = STRING: Gi0/17
IF-MIB::ifName.10118 = STRING: Gi0/18
IF-MIB::ifName.10119 = STRING: Gi0/19
IF-MIB::ifName.10120 = STRING: Gi0/20
IF-MIB::ifName.10121 = STRING: Gi0/21
IF-MIB::ifName.10122 = STRING: Gi0/22
IF-MIB::ifName.10123 = STRING: Gi0/23
IF-MIB::ifName.10124 = STRING: Gi0/24
IF-MIB::ifName.10125 = STRING: Gi0/25
IF-MIB::ifName.10126 = STRING: Gi0/26
IF-MIB::ifName.10127 = STRING: Gi0/27
IF-MIB::ifName.10128 = STRING: Gi0/28
IF-MIB::ifName.10129 = STRING: Gi0/29
IF-MIB::ifName.10130 = STRING: Gi0/30
IF-MIB::ifName.10131 = STRING: Gi0/31
IF-MIB::ifName.10132 = STRING: Gi0/32
IF-MIB::ifName.10133 = STRING: Gi0/33
IF-MIB::ifName.10134 = STRING: Gi0/34
IF-MIB::ifName.10135 = STRING: Gi0/35
IF-MIB::ifName.10136 = STRING: Gi0/36
IF-MIB::ifName.10137 = STRING: Gi0/37
IF-MIB::ifName.10138 = STRING: Gi0/38
IF-MIB::ifName.10139 = STRING: Gi0/39
IF-MIB::ifName.10140 = STRING: Gi0/40
IF-MIB::ifName.10141 = STRING: Gi0/41
IF-MIB::ifName.10142 = STRING: Gi0/42
IF-MIB::ifName.10143 = STRING: Gi0/43
IF-MIB::ifName.10144 = STRING: Gi0/44
IF-MIB::ifName.10145 = STRING: Gi0/45
IF-MIB::ifName.10146 = STRING: Gi0/46
IF-MIB::ifName.10147 = STRING: Gi0/47
IF-MIB::ifName.10148 = STRING: Gi0/48
IF-MIB::ifName.10149 = STRING: Gi1/1
IF-MIB::ifName.10150 = STRING: Gi1/2
IF-MIB::ifName.10151 = STRING: Gi1/3
IF-MIB::ifName.10152 = STRING: Gi1/4
IF-MIB::ifName.10201 = STRING: Te1/1
IF-MIB::ifName.10202 = STRING: Te1/2
IF-MIB::ifName.10501 = STRING: Nu0
IF-MIB::ifName.10502 = STRING: Fa0

and the vlans created in Layer2 are:
sh vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Po1, Eth1/14, Eth1/15, Eth1/16
                                                Eth1/18, Eth1/19, Eth1/20
                                                Eth1/22, Eth1/23, Eth1/24
                                                Eth1/26
2500 MANAGEMENT                       active    Po1
2003 SERVICE A                        active    Po1
2004 SERVICE B                        active    Po1
2005 SERVICE C                        active    Po1
2006 SERVICE D                        active    Po1

Only vlan 1 and 2500 is pooled because have a Layer3 interface.

The test was done in a Nx5k. The same behavior happens for Nexus 7000.

In order to get the vlan list, you will have to walk in another mib:
snmpwalk -v 1 -c public 10..1.1.1 SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1

SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.1 = STRING: "default"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.2003 = STRING: "SERVICE A"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.2004 = STRING: "SERVICE B"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.2005 = STRING: "SERVICE C"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.2006 = STRING: "SERVICE D"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.2500 = STRING: "MANAGEMENT"






No comments: