cisco: get mac address from cdp neighbors

9,207

Solution 1

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

Solution 2

SolarWinds Switch Port Mapper, available as part of the Network Engineer's Toolset is a great tool that will do what you are asking as long as the switch's management interface supports the proper SNMP OIDs. Both a GUI and CLI (Windows command window) available.

A lot of good details in the Switch Port Mapper Documentation as well.

A trial is available, the full version comes with Engineer's Toolset or can be purchased separately.

I do not work for SolarWinds but can speak very highly of Engineer's Toolset.

Share:
9,207

Related videos on Youtube

jogo
Author by

jogo

Updated on September 18, 2022

Comments

  • jogo
    jogo over 1 year

    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?

  • ravi yarlagadda
    ravi yarlagadda over 12 years
    Well, yes, but the MAC table for that port will have all the devices connected to the connected switch, too..
  • Paul Ackerman
    Paul Ackerman over 12 years
    @Shane. True, if the connected device is a switch. If it's a router - you're all set. In the case of a switch, I suppose I would get the IP from show cdp neigh details, ping it from the switch, then show arp | inc IP to get the MAC of the switch.