Mac – DELL switch 6248 port and mac mapping using SNMP

macmappingportsnmp

I have a Dell 6248 switch. I connect some of my servers to it and want to know which server nic connected to which switch port. I try using snmpwalk to get this information, but I just can get mac/ip mapping of my server nic from switch, I still can't get which switch port it connect.

I try a tool named Managed Switch Port Mapping tool, it can show which switch port is connected to which nic/ip. I use WireShare to get all snmp packets but still can't find what's the snmp oid to get this information.

Anyone knows how to get this?

Best Answer

You have to do a little bit of tracking through BRIDGE-MIB and IF-MIB.

(Caveat: I don't have your specific switch model to test on, but these are standard MIBs, so this should work.)

Use dot1dTpFdbAddress (.1.3.6.1.2.1.17.4.3.1.1) from BRIDGE-MIB to find the MAC addresses (example shows a single line of snmpwalk output for clarity, you'll probably get several rows returned):

>snmpwalk -v 2c -c public myswitch .1.3.6.1.2.1.17.4.3.1.1
SNMPv2-SMI::mib-2.17.4.3.1.1.0.20.124.62.198.161 = Hex-STRING: 00 14 7C 3E C6 A1

Take those numbers that follow the base OID (looking at the example, I'm talking about 0.20.124.62.198.161). Use them to find the value of dot1dTpFdbPort (.1.3.6.1.2.1.17.4.3.1.2), also from BRIDGE-MIB:

>snmpwalk -v 2c -c public myswitch .1.3.6.1.2.1.17.4.3.1.2
SNMPv2-SMI::mib-2.17.4.3.1.2.0.20.124.62.198.161 = INTEGER: 794

Take the integer values from dot1dTpFdbPort (794 in the example) and use them to find the value of dot1dBasePortIfIndex (.1.3.6.1.2.1.17.1.4.1.2), again from BRIDGE-MIB:

>snmpwalk -v 2c -c public myswitch .1.3.6.1.2.1.17.1.4.1.2
SNMPv2-SMI::mib-2.17.1.4.1.2.794 = INTEGER: 200

That value is your ifIndex (200 in the example). Use that to pull a human-friendly value out of ifName (.1.3.6.1.2.1.31.1.1.1.1), from IF-MIB:

>snmpwalk -v 2c -c public myswitch .1.3.6.1.2.1.31.1.1.1.1
IF-MIB::ifName.200 = STRING: 4/20