How to find which devices are connected to switch port


Whenever we have an audit or want to find which switch ports are connected to which devices, we can get the same information using the remote machine’s IP or MAC address. This blog will see How to find the port a device is connected to, based on IP, on a Cisco switch.

Take the Switch access via SSH, telnet or Putty. Here we will take the ssh using the putty software.

Putty for SSH
Putty for SSH

Enter the IP address of the switch.


Layer Discovery Protocol

We will first check the Link Layer Discovery Protocol (LLDP) as this is the standard protocol for all switch vendors. This protocol is similar to Cisco’s (Cisco Discovery Protocol). Cisco all switches supports the IEEE 802.1ab version of LLDP. This allows servers, storage, and any network devices to show the link information about themselves to our network devices.

Link Layer Discovery Protocol shows the below information.

  • Port information
  • Device ID
  • Port ID
  • System name or Hostname
  • Capabilities
  • TTL

Once you connected to the switch enter the below command

TOR-SW-1#show lldp neighbors
show lldp neighbors
Show lldp neighbors

Cisco Discovery Protocol

Cisco Discovery Protocol shows the below information.

  • Device ID
  • Local Interfaces
  • Advertise version
  • Time to Live
  • Capability
  • Platform (Windows, Linux)
  • Port ID

TOR-SW-1#show cdp neighbors
show cdp neighbors
Show cdp neighbors

Using MAC address table

The difference between MAC address and ARP table is The MAC address table is used by the switch to map MAC Addresses to a specific interface on the switch. These usually expire every 5 minutes and are updated by reading the source address of the frame entering the interface. Your switch should have a MAC/CAM Table as a layer of two devices, whereas The ARP address table is used to map MAC Addresses to IP addresses. If no ARP entry exists, an ARP broadcast is sent out, and the table is updated with the response. These usually expire after 2-4 hours. Each host connected to the network should maintain its own ARP table.

Enter the following command to find port details by MAC address

TOR-SW-1#show mac-address-table address 3C:2C:30:B6:0B:63
Destination Address  Address Type  VLAN  Destination Port
-------------------  ------------  ----  --------------------

3C:2C:30:B6:0B:63          Dynamic      10     **FastEthernet1/0/4**
show mac-address-table
Show mac-address-table

We can see that the port details are showing on switch port with vlan also.

One comment

Leave a Reply