Commands to Find Device Mac Address on Cisco Switch Port

Rashmi Bhardwaj | Blog,Config & Troubleshoot,Routing & Switching
Google ADs

At times, network and IT admins are faced with the challenge to find out which device is connected to which port of the catalyst Switch or which port of the switch is a specific device mac address coming from.

What is a MAC Address?

A device MAC address (Media Access Control address) is a unique identifier assigned to a network interface controller (NIC) for communications at the data link layer of a network segment. The MAC address is used within a local network to direct data to the correct device.

Structure

A MAC address is divided into two parts:

Google ADs

  1. Organizationally Unique Identifier (OUI): The first 24 bits (3 bytes) identify the manufacturer or vendor of the NIC.
  2. Network Interface Controller (NIC) Specific: The last 24 bits (3 bytes) are unique to the specific device.

Practical Use

  1. Network Configuration: MAC addresses are often used in network configuration and troubleshooting.
  2. Security: MAC address filtering can be used to control access to a network.
  3. Network Monitoring: Network administrators use MAC addresses to monitor and manage network traffic and devices.

By using the unique MAC address of a device, network equipment such as switches and routers can direct data accurately within a local network, ensuring reliable communication between devices.

How to Find Port by Device MAC Address

The below command helps to view which port the Cisco show MAC address is being learned from.

The command syntax is –

SWITCH# show mac-address-table

MAC Address Table

VLANMAC Address Type Ports
10009.aabb.3ad2   DYNAMIC Fa0/3
10009.aabb.06e9  DYNAMIC Fa0/10
10009.5bdc.af04 DYNAMIC  Fa0/15
100e0.ba2c.acd1   DYNAMIC Fa0/16
100e0.ab3c.3e6f DYNAMIC Fa0/22

Total MACAddresses for this criterion: 5

With the command, you can figure out which MAC address is on which port. The mac address or CAM table shows the VLAN associated with the port, MAC being learned on the port (i.e. mac address of the connected device) and port number. Only ports which have the device connected and active will show the mac address detail.

If Switch Port is Known

If you know the switch port you can use the following command

switch# show mac-address-table | include Fa0/5

If MAC Address is Known

If you know the MAC address and want to know which port the MAC address is coming from, use the following command

switch# show mac-address-table | include 0009.aabb.06e9

With the above command, one can figure out which MAC address is on which port of catalyst switch. Only ports which have a device connected and active will show the MAC address detail.

Step-by-Step Guide: Scenario Example

To find the port to which a device with a specific MAC address is connected on a Cisco switch, follow these steps:

1. Log in to the switch

Access the switch through SSH or console connection.

2. Enter privileged EXEC mode

Switch> enable

You might need to enter the enable password if prompted.

3. Show MAC address table for the specific MAC address

Use the show mac address-table address command to display the MAC address table entry for the specific MAC address.

Switch# show mac address-table address [mac-address]

Replace [mac-address] with the actual MAC address of the device you are looking for, e.g., a1b2.c3d4.e5f6.

Example Command:

Switch# show mac address-table address a1b2.c3d4.e5f6

This command will display information about the MAC address, including the port to which the device is connected. The output will typically show something like this:

          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
  10    a1b2.c3d4.e5f6    DYNAMIC     Gi1/0/1

In this example, the device with the MAC address a1b2.c3d4.e5f6 is connected to port Gi1/0/1 on VLAN 10.

Related –

Ways to find MAC address

 How to find MAC Address of Access Point

ABOUT THE AUTHOR


Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart