Cisco: get mac address from cdp neighbors

ciscomacsnmpswitch

I need to find out the MAC addresses and ports of devices connected directly to a Cisco switch, preferably via SNMP. the best way i found is with CDP neighbors, but i don't find the MAC addresses, only ip and hostname.

currently i get the mac from the ip via RFC1286-MIB::dot1dTpFdbPort, but this is very unreliable as ip addresses are not always listed in this table. does someone know a better way to retrieve the mac address?

Best Answer

cdp neighbors will show you other Cisco devices and on what port they are attached. If you're looking for the mac on those devices, do a show mac address-table dynamic interface X where X is the interface on which the device is connected. You can leave off interface X to see all mac addresses of devices connected to the switch. Not sure how to get this via SNMP