Using SNMP, how can I find the VLANs associated with an interface

  • 0
  • 1
  • Question
  • Updated 3 months ago
  • Answered
Using SNMP, how can I find the VLANs associated with an interface?

I know I can snmpwalk 1.3.6.1.4.1.1916.1.4.17.1.1 but that only starts "at the top" (ie the first port), and takes AGES to get to the actual interface I'm interested in...


Thanks for any pointers!
Photo of Florian Knorn

Florian Knorn

  • 90 Points 75 badge 2x thumb

Posted 3 months ago

  • 0
  • 1
Photo of Bastian Sprotte

Bastian Sprotte, Employee

  • 1,610 Points 1k badge 2x thumb
Hello Florian,
EXOS has in the latest version implemented the dot1Q MIB which is an MIB2 value.
Can you confirm you looking for Software EXOS 21.xx and later.
regards
BAstian
.
Photo of Florian Knorn

Florian Knorn

  • 90 Points 75 badge 2x thumb
Hi Bastia, thanks for the quick reply. Unfortunately we are running v.15 and 16 in our company...
Photo of Frank

Frank

  • 3,592 Points 3k badge 2x thumb
Florian,

I wrote a small PHP script with a web interface that lists my switches, which port is in what VLANS (tagged/untagged) and also lists all ports on all switches that are in the same VLAN. It uses SNMP to query the switches and a little bit of MySQL to store the information

It's a hack that does what I needed. It doesn't follow best practice developer standards, but it works. "Butterknife-as-screwdriver". If I had to redo it, it would probably be in python, but knowing myself, it would probably still be a hack ;)

I'll be more than happy to share that with you. Can this forum do private messages to exchange email addresses?

    Frank
Photo of Frank

Frank

  • 3,592 Points 3k badge 2x thumb
Basically I'm using these OIDs to crawl my way through the switches: (Yay for the formatting squish...)
"Extreme" => array ("vname"     => ".1.3.6.1.4.1.1916.1.2.1.2.1.2",   //extremeVlanIfDescr.vlan_no = string NOT the tag, though
"vport" => ".1.3.6.1.4.1.1916.1.4.17.1.1", //extremePortVlanInfoDescr.port.vlan_no = string
"vtag" => ".1.3.6.1.4.1.1916.1.2.1.2.1.10", //extremeVlanIfVlanId.vlan_no = integer
"tagged" => ".1.3.6.1.4.1.1916.1.2.6.1.1.1", //extremeVlanOpaqueTaggedPorts .VLANid.SLOT = Hex-String
"untagged" => ".1.3.6.1.4.1.1916.1.2.6.1.1.2" //extremeVlanOpaqueUntaggedPorts .VLANid.SLOT = Hex-String
)
(Edited)
Photo of Florian Knorn

Florian Knorn

  • 90 Points 75 badge 2x thumb
Dear Frank,

Thank you, I am aware of those MIBs and have played around with them. However, I am looking at core switches of a large ISP with a great many VLANs and interfaces, so this technique is not directly an option. I was rather wanting to double check if I missed something, but it looks like I haven't; at least not with the version of EXOS at hand.

Thank you, gentlemen!
Photo of Frank

Frank

  • 3,592 Points 3k badge 2x thumb
Florian,
Sadly, I agree with you. What's even worse is that it appears as if the other players don't seem to do it either, so if that OID really works on 22.x, Extreme might just be the first one to give us what we need ;)

I think the only remaining option (if you know which port is interesting to you), do an automated ssh session and a "show vlan port X" and "screenscrape"/parse the output. Either with "Expect" scripts or some python magic. That way you'd not only get the vlans with their tags, but also VR and other information.

Good luck!