10

Cisco switches seem to allocate unique MAC address for each interface they have, this includes ports and vlan interfaces.

These unique MAC are derived from a "Base ethernet MAC Address", which can be found with:

MySwitch#show version
...snip...
Base ethernet MAC Address        : 70:10:5C:22:83:80

The interfaces MAC, then look like:

MySwitch#show interface FastEthernet0/1
Hardware is Fast Ethernet, address is 7010.5c22.8381
...snip...

MySwitch#show interface vlan87
Hardware is EtherSVI, address is 7010.5c22.83c6
...snip...

Then, if I inspect a CDP packet received from a switch, the MAC address on the packet is the actual "port" MAC address.

Is there a reliable way to infer the switch "Base ethernet MAC Address" from receiving such a CDP interface MAC Address, so that I can use that "Base ethernet MAC Address" as a globally unique identifier for the switch device equipment on the network?

  • 2
    Random question that's more than random: Are you only concerned with 2960S switches, or other Cisco products too? If you're dealing with other Cisco products, please edit the list of products into your question – Mike Pennington Aug 5 '13 at 17:39
  • Are the switches missing MGMT ADDR or is the MGMT ADDR not unique in your case? Maybe you could abuse 'VTP Domain' as separator, add customerID there. Then CustomerID+MGMT_ADDR gives you unique identifier for device? Even if what you want to do is possible, would it be possible after upgrade? I would be very uncomfortable building system which assumes it'll continue working. – ytti Aug 6 '13 at 7:06
4

Is there a reliable way to infer the switch "Base ethernet MAC Address" from receiving such a CDP interface MAC Address, so that I can use that "Base ethernet MAC Address" as a globally unique identifier for the switch device equipment on the network?

You can't determine the base ethernet mac from CDP without guessing or assumptions about how Cisco behaves today (as well as future behavior). On the other hand, if all you want is a unique identifier, use the Chassis serial number; however, that would require polling the CDP source for entPhysicalSerialNum... a small price to eliminate guesswork.

entPhysicalSerialNum has the added bonus of working across many of Cisco's current platforms.

Sample SNMP walk of entPhysicalSerialNum:

[mpenning@tsunami ~]$ snmpbulkwalk -OXsq -v 2c -c ciscoro -m ENTITY-MIB \
  172.16.1.200 entPhysicalDescr
entPhysicalDescr[1] 2650 chassis
entPhysicalDescr[2] 2600 Chassis Slot
entPhysicalDescr[3] C2600 Mainboard
entPhysicalDescr[4] 2600 DaughterCard Slot
entPhysicalDescr[5] 2600 DaughterCard Slot
entPhysicalDescr[6] AIM Container Slot 0
entPhysicalDescr[7] 2600 Chassis Slot
entPhysicalDescr[8] One port Fastethernet TX
entPhysicalDescr[9] AmdFE
entPhysicalDescr[10] AmdFE
[mpenning@tsunami ~]$ snmpbulkwalk -OXsq -v 2c -c ciscoro -m ENTITY-MIB \
  172.16.1.200 entPhysicalSerialNum
entPhysicalSerialNum[1] JAB05290Z8Q
entPhysicalSerialNum[2]
entPhysicalSerialNum[3] yyyyyyyyyyy
entPhysicalSerialNum[4]
entPhysicalSerialNum[5]
entPhysicalSerialNum[6]
entPhysicalSerialNum[7]
entPhysicalSerialNum[8] 25809045
entPhysicalSerialNum[9]
entPhysicalSerialNum[10]
[mpenning@tsunami ~]$
| improve this answer | |
  • Is the chassis serial number available over SNMP? – chrylis -cautiouslyoptimistic- Aug 8 '13 at 2:46
  • Yes, please look at entPhysicalSerialNum... you have to walk it and cross-reference with entPhysicalDescr – Mike Pennington Aug 8 '13 at 2:49
0

The size depends on the specific Cisco device, but you'll notice that the first MAC address ends in 80 (and I've personally only ever seen Cisco switches end in 80 or 00). It should be possible to take the MAC address you're seeing on the SVI and just mask off 0x7f on the LSB, though you'd need to confirm the size of the blocks, as they may vary with switch port density, and I know they vary for line cards. Try sh diag.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.