Querying a switch's Switching Table through SNMP
$ snmpwalk -v 1 -c public 10.16.15.254 .1.3.6.1.2.1.17.4.3 | grep 0.22.54.109.180.91
SNMPv2-SMI::mib-2.17.4.3.1.1.0.22.54.109.180.91 = Hex-STRING: 00 16 36 6D B4 5B
SNMPv2-SMI::mib-2.17.4.3.1.2.0.22.54.109.180.91 = INTEGER: 8
SNMPv2-SMI::mib-2.17.4.3.1.3.0.22.54.109.180.91 = INTEGER: 3
In this case we see that 00 16 36 6D B4 5B (which in decimal is 0.22.54.109.180.91) is reachable through port 8.
The oid .1.3.6.1.2.1.17.4.3 (.iso.org.dod.internet.mgmt.mib-2.dot1dBridge.dot1dTp.dot1dTpFdbTable) is the mib-2 table detailing which interface to use to reach a particular MAC address.
The entries:
- entry 1 is the MAC address in hex
- entry 2 is the port to use
- entry 3 is the type of entry (3 == "learn", which is what most of the entries will be)