Whether you are auditing physical ports, tracking down an unauthorized endpoint, or resolving an IP conflict, identifying devices connected to a Cisco switch is a fundamental network administration task. Because enterprise switches forward traffic across Layer 2 and Layer 3 boundaries, no single command reveals every detail about every host. Instead, you must correlate Layer 2 MAC address tables, Layer 3 ARP and snooping databases, and neighbor discovery protocols.
This guide walks through inspecting physical interfaces, mapping Layer 2 addresses to IP addresses, discovering network infrastructure, consulting command syntax specifications, and automating device audits at scale.
Table of Contents
Mapping Physical Ports to MAC Addresses
Cisco switches build a Layer 2 Content Addressable Memory (CAM) table that dynamically binds the source MAC address of incoming Ethernet frames to their ingress switch ports and VLANs. To identify which endpoints are plugged into your physical ports, query this table using the show mac address-table command.
Step 1: Filter Out Internal Switch Entries
Running a bare show mac address-table displays every entry, including internal system CPU addresses and multicast groups. To view only physical client endpoints, isolate dynamic entries:
Switch# show mac address-table dynamic
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
10 0050.56a1.2c4d DYNAMIC Gi1/0/1
10 001b.d4c2.88ef DYNAMIC Gi1/0/2
20 d46a.a811.3b20 DYNAMIC Gi1/0/3
20 000c.29f4.10aa DYNAMIC Gi1/0/24
Step 2: Inspect a Specific Physical Port
When you need to know what device is plugged into a particular port (such as GigabitEthernet1/0/1), specify the interface:
Switch# show mac address-table interface GigabitEthernet1/0/1
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
10 0050.56a1.2c4d DYNAMIC Gi1/0/1
Note: If multiple dynamic MAC addresses appear on an interface that is not configured as an uplink trunk, an unmanaged switch, hypervisor virtual switch, or docking station is connected downstream.
Step 3: Locate Where a Specific MAC Address Resides
If you have a device’s physical hardware address and need to track down its physical wall jack or switch port, query by address:
Switch# show mac address-table address 0050.56a1.2c4d
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
10 0050.56a1.2c4d DYNAMIC Gi1/0/1
Step 4: Narrow Results by VLAN
For segmented networks with hundreds of hosts, filter the table by VLAN to inspect only specific broadcast domains:
Switch# show mac address-table vlan 20
Resolving IP Addresses of Connected Endpoints
Pure Layer 2 switches do not read Layer 3 IP headers when forwarding frames, which means the MAC address table does not contain IP addresses. To correlate a MAC address and physical port to an IP address, use one of three methods: the switch’s local ARP cache, the DHCP snooping binding database, or Switch-Integrated Security Features (SISF) / IP Device Tracking.
Method 1: The Layer 3 ARP Table
If your Cisco switch operates at Layer 3 (with Switched Virtual Interfaces / SVIs routing traffic), it maintains an Address Resolution Protocol (ARP) table that directly maps IP addresses to MAC addresses.
- Display the full ARP cache:
text
Switch# show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.1.10.15 12 0050.56a1.2c4d ARPA Vlan10
Internet 10.1.10.22 4 001b.d4c2.88ef ARPA Vlan10
Internet 10.1.20.50 0 d46a.a811.3b20 ARPA Vlan20 - Filter the ARP table by the MAC address retrieved from your Layer 2 lookup:
text
Switch# show ip arp 0050.56a1.2c4d
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.1.10.15 12 0050.56a1.2c4d ARPA Vlan10 - Match the hardware address back to
show mac address-table address <mac>to complete the Port $\rightarrow$ MAC $\rightarrow$ IP mapping.
Note: If the switch is purely Layer 2, execute show ip arp on the default gateway router or core switch serving that VLAN.
Method 2: DHCP Snooping Binding Database
When DHCP Snooping is enabled on the switch, it intercepts DHCP transactions and maintains an authoritative database binding client IP addresses, MAC addresses, and ingress physical ports—even on pure Layer 2 switches.
Query the database directly:
Switch# show ip dhcp snooping binding
MacAddress IpAddress Lease(sec) Type VLAN Interface
------------------ --------------- ---------- ------------ ---- --------------------
00:50:56:A1:2C:4D 10.1.10.15 86400 dhcp-snooping 10 GigabitEthernet1/0/1
00:1B:D4:C2:88:EF 10.1.10.22 43200 dhcp-snooping 10 GigabitEthernet1/0/2
Method 3: IP Device Tracking and SISF
Modern Cisco Catalyst platforms running Cisco IOS-XE use IP Device Tracking (IPDT) or the Switch-Integrated Security Features (SISF) database to track active hosts per port regardless of static or dynamic addressing.
- On modern Cisco IOS-XE (Catalyst 9000 series):
text
Switch# show device-tracking database
Binding Table has 2 entries, 2 dynamic
Codes: L - Local, S - Static, ND - Neighbor Discovery, ARP - Address Resolution Protocol
Network Layer Address Link Layer Address Interface Vlan PRF State Time Left
10.1.10.15 0050.56a1.2c4d Gi1/0/1 10 ARP REACHABLE 120 s - On legacy Cisco IOS platforms:
text
Switch# show ip device tracking all
Discovering Network Infrastructure with CDP and LLDP
End-user PCs and printers do not broadcast protocol neighbor advertisements, but enterprise infrastructure devices (switches, routers, IP phones, and wireless access points) do. Cisco Discovery Protocol (CDP, proprietary) and Link Layer Discovery Protocol (LLDP, IEEE 802.1AB) allow you to view the management IP addresses, models, and remote interface names of adjacent equipment.
Discovering Adjacent Cisco Devices Using CDP
CDP is enabled by default on all Cisco interfaces.
- Obtain a summary of connected network devices:
“`text
Switch# show cdp neighbors
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
S – Switch, H – Host, I – IGMP, r – Repeater, P – Phone
Device ID Local Intrfce Holdtme Capability Platform Port ID
Core-SW01.lab Gig 1/0/24 142 S I C9300-24T Gig 1/0/1
AP-Floor2 Gig 1/0/12 175 H T AIR-AP380 Gig 0
SEP001122334455 Gig 1/0/5 130 H P IP Phone Port 1
2. **Inspect management IP addresses and firmware versions:**text
Switch# show cdp neighbors GigabitEthernet1/0/24 detail
Device ID: Core-SW01.lab
Entry address(es):
IP address: 10.1.1.2
Platform: cisco C9300-24T, Capabilities: Switch IGMP
Interface: GigabitEthernet1/0/24, Port ID (outgoing port): GigabitEthernet1/0/1
Holdtime : 142 sec
Version :
Cisco IOS Software [Cupertino], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 17.9.3
Native VLAN: 1
Duplex: full
“`
Discovering Multi-Vendor Infrastructure Using LLDP
For non-Cisco equipment (e.g., third-party switches, Linux hypervisors, and SIP phones), enable and query LLDP:
- Verify LLDP is running globally:
text
Switch(config)# lldp run - Inspect LLDP neighbors:
text
Switch# show lldp neighbors
Capability codes:
(R) Router, (B) Bridge, (W) WLAN Access Point, (T) Telephone
Device ID Local Intf Hold-time Capability Port ID
srv-esxi-01 Gi1/0/3 120 B vmnic0
pdu-rack3 Gi1/0/18 120 B eth0 - View detailed endpoint attributes:
text
Switch# show lldp neighbors detail
Cisco IOS Command Reference and Output Syntax
The following formal reference provides standard command syntax, optional parameters, and output field definitions across Cisco IOS and IOS-XE platforms.
1. show mac address-table
Displays Layer 2 MAC address entries forwarded across physical and port-channel interfaces.
Syntax
show mac address-table [address mac-address] [dynamic | static] [interface interface-id] [vlan vlan-id]
Parameter Descriptions
address mac-address: (Optional) Limits output to a 48-bit MAC formatted asxxxx.xxxx.xxxx.dynamic: (Optional) Filters table to dynamically learned Layer 2 addresses, excluding CPU and broadcast entries.static: (Optional) Filters table to administratively defined or internal system MAC entries.interface interface-id: (Optional) Specifies physical (e.g.,GigabitEthernet1/0/1) or logical (e.g.,Port-channel1) port.vlan vlan-id: (Optional) Restricts display to addresses learned in the specified VLAN ID (1–4094).
Output Field Specifications
Vlan: The broadcast domain or 802.1Q tag associated with the learned frame.Mac Address: The unicast or multicast hardware address recorded by the switch fabric.Type: Allocation method (DYNAMIClearned via data plane,STATICconfigured by admin or system).Ports: The physical port, port-channel, orDrop/CPUdesignation associated with the entry.
2. show ip arp
Displays the local IPv4-to-MAC address mapping table derived from ARP exchanges.
Syntax
show ip arp [vrf vrf-name] [interface-type interface-number] [ip-address] [mac-address]
Parameter Descriptions
vrf vrf-name: (Optional) Displays entries for a specific Virtual Routing and Forwarding instance.interface-type interface-number: (Optional) Limits display to ARP entries associated with a routed port or SVI.ip-address: (Optional) Filters by destination IPv4 host address.mac-address: (Optional) Filters by 48-bit hardware address formatted asxxxx.xxxx.xxxx.
Output Field Specifications
Protocol: Network layer protocol (typicallyInternetfor IPv4).Address: The assigned IPv4 address of the endpoint.Age (min): Elapsed time in minutes since the entry was refreshed (hyphen-indicates local interface).Hardware Addr: The Layer 2 physical address corresponding to the resolved IP.Type: Encapsulation standard (typicallyARPAfor standard Ethernet).Interface: The Layer 3 logical or routed interface through which the endpoint is reached.
3. show cdp neighbors
Displays summary topology information advertised by directly connected devices via Cisco Discovery Protocol.
Syntax
show cdp neighbors [interface-id] [detail]
Parameter Descriptions
interface-id: (Optional) Limits neighbor output to devices heard on a specific interface.detail: (Optional) Expands output to display network layer addresses, software versions, native VLANs, and power settings.
Output Field Specifications
Device ID: Configured hostname or serial number of the neighbor device.Local Intrfce: The port on the local switch receiving CDP packets.Holdtme: Remaining hold time in seconds before the entry is discarded if no update is received.Capability: Device functional roles (e.g.,Rfor Router,Sfor Switch,Pfor Phone).Platform: Hardware chassis model of the remote neighbor.Port ID: Remote physical port transmitting the neighbor advertisement.
Automating Connected Device Audits with Python
Manually correlating MAC tables, ARP records, and switch ports across dozens of switches is time-consuming. You can automate this process using Python and the netmiko multi-vendor SSH library.
The script below connects to a Cisco switch, extracts dynamic Layer 2 MAC entries, queries the ARP table, correlates physical ports to IP addresses, and exports the inventory to a CSV file.
Prerequisites
pip install netmiko
Script Template
import csv
import re
from netmiko import ConnectHandler
# --- Switch Connection Details ---
SWITCH_PARAMS = {
"device_type": "cisco_ios",
"host": "192.168.1.10",
"username": "admin",
"password": "SecurePassword123",
"secret": "EnablePassword123",
}
OUTPUT_CSV = "connected_devices.csv"
def extract_device_inventory(device_params):
print(f"Connecting to {device_params['host']}...")
connection = ConnectHandler(**device_params)
connection.enable()
# Retrieve Layer 2 and Layer 3 tables
mac_output = connection.send_command("show mac address-table dynamic")
arp_output = connection.send_command("show ip arp")
connection.disconnect()
# Parse ARP Table into a MAC -> IP lookup dictionary
# Example format: Internet 10.1.10.15 12 0050.56a1.2c4d ARPA Vlan10
arp_dict = {}
arp_regex = re.compile(
r"Internet\s+(\d+\.\d+\.\d+\.\d+)\s+\S+\s+([0-9a-fA-F\.]+)\s+ARPA"
)
for line in arp_output.splitlines():
match = arp_regex.search(line)
if match:
ip_addr, mac_addr = match.group(1), match.group(2).lower()
arp_dict[mac_addr] = ip_addr
# Parse MAC Address Table
# Example format: 10 0050.56a1.2c4d DYNAMIC Gi1/0/1
mac_regex = re.compile(
r"^\s*(\d+)\s+([0-9a-fA-F\.]+)\s+DYNAMIC\s+(\S+)", re.MULTILINE
)
device_records = []
for match in mac_regex.finditer(mac_output):
vlan = match.group(1)
mac = match.group(2).lower()
interface = match.group(3)
resolved_ip = arp_dict.get(mac, "Unresolved / External L3")
device_records.append(
{
"Port": interface,
"VLAN": vlan,
"MAC_Address": mac,
"IP_Address": resolved_ip,
}
)
return device_records
def save_to_csv(records, filename):
fieldnames = ["Port", "VLAN", "MAC_Address", "IP_Address"]
with open(filename, mode="w", newline="", encoding="utf-8") as file:
writer = csv.DictWriter(file, fieldnames=fieldnames)
writer.writeheader()
writer.writerows(records)
print(f"Inventory saved: {filename} ({len(records)} endpoints discovered)")
if __name__ == "__main__":
records = extract_device_inventory(SWITCH_PARAMS)
save_to_csv(records, OUTPUT_CSV)
Dedicated Switch Port Mapping Software vs. CLI Audits
While manual CLI queries and Python scripts work well for ad-hoc troubleshooting, enterprise campuses with thousands of access ports benefit from dedicated Network Discovery and Switch Port Mapping tools. These platforms poll switches on a schedule via SNMP, SSH, or streaming telemetry to maintain historic records of connection states, MAC movements, and port capacities.
| Tool Name | Discovery Methods | Key Capabilities | Best Suited For | Licensing Model |
|---|---|---|---|---|
| SolarWinds User Device Tracker (UDT) | SNMP (v2c/v3), CLI | Automated IP/MAC/Port correlation, rogue device alerts, port shutdown capability, historical port usage logs | Mid-to-large enterprise networks needing real-time endpoint tracking and audit histories | Commercial (Per-port tier or subscription) |
| ManageEngine OpUtils | SNMP, ICMP, CLI | Visual 3D rack and port mapping, IP address management (IPAM), rogue device detection, wake-on-LAN | Campus IT departments managing physical cabling and access-layer capacity | Commercial (Per-device/switch license) |
| Netdisco | SNMP, SSH (via Netmiko) | Open-source automatic L2/L3 topology mapping, IP inventory, wireless AP host mapping, MAC search history | Organizations seeking a zero-license-cost, community-supported network mapper | Open-Source (Free, BSD License) |
| NetBox with NetBox Device Discovery | REST API, Webhooks, Python Agents | Source-of-truth IPAM and DCIM, tracking connected interfaces, cabling documentation, state validation | Automation-first teams integrating CI/CD pipelines with source-of-truth inventory | Open-Source Core / Commercial NetBox Cloud |
| Paessler PRTG Network Monitor | SNMP, WMI, Packet Sniffing | Port bandwidth monitoring, connection status alarms, basic MAC/IP table sensor mapping | Infrastructure monitoring where endpoint tracking is bundled with general network metrics | Commercial (Sensor-based tier; free up to 100 sensors) |
Conclusion
Tracking connected devices on a Cisco switch requires moving down the OSI model from Layer 3 addressing to Layer 2 physical port bindings:
- For client endpoints, identify the physical interface and VLAN using
show mac address-table dynamic, then map that hardware address to an IPv4 host usingshow ip arp,show ip dhcp snooping binding, orshow device-tracking database. - For infrastructure nodes like switches, routers, access points, and VoIP phones, read adjacent capabilities and management IP addresses directly via
show cdp neighbors detailorshow lldp neighbors detail. - For ongoing operations, use scripted CLI extractions via Python for targeted audits, or deploy dedicated switch port mapping software to maintain automated, historical visibility into physical port allocations across your campus.











Comments