I have a LAN consisting of switches connected to each other then to some devices, How to get the mac address of the switch connected to a specific port on the main switch then get the ports and device names who have their mac address present in the switching table.

I know it is a trivial question but I am so confused and google has disappointed me for the first time.

  • First of all, do the spoke switches have layer 3 interfaces, or management interfaces? If they are "dumb" layer 2 switches, they may not have a MAC? – jwbensley Jun 19 '13 at 14:01
  • the switch mac is not the problem it is how to get the devices connected to this switch and the port they are on and their mac addresses using the cli – user2402550 Jun 19 '13 at 14:07
  • 1
    You could start by telling us what make and model these switches are. – joeqwerty Jun 19 '13 at 14:45

The switch probably doesn't have a MAC address that you care about. What you care about is the switching table, which is the table that the switch uses to list which MAC addresses are available through which ports.

If you have a managable switch, this table should be viewable through the management interface. Refer to your documentation, the magic word is probably "switching" or "forwarding" or "bridge".

If you have a snmp-enabled switch, you can probably query the snmp table directly. This will require at least some messing around with net-snmp, and possibly some scripting if you are up for that. Alternatively there are tools available which can extract this information for you and display it, such as NetDisco.

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.