rss logo

How to Find a Device’s IP Address on a Cisco Switch Port

Cisco logo

This guide explains how to identify the IP address of a device connected to a physical interface on a Cisco switch.

Network Architecture

The diagram below illustrates the network setup we'll be working with. Our goal is to determine which IP addresses are associated with the devices connected to interfaces Gi1/0/1 and Gi1/0/2 on the switch.

Diagram showing the network architecture of a Cisco switch with devices connected to ports Gi1/0/1 and Gi1/0/2, including their IP and MAC addresses.

Map IP Addresses to Physical Ports

Configure an IP Address on the Switch

Note: The switch must have an IP address configured in the same VLAN as the devices you want to identify. In this example, all devices are located in VLAN 1.

  • To configure the VLAN 1 interface, use the following commands:
switch01(config)# interface vlan 1
switch01(config-if)# ip address 192.168.1.1 255.255.255.0
switch01(config-if)# no shutdown

Retrieve MAC Addresses

As mentioned earlier, switches operate at Layer 2 of the OSI model, which means there is no single command to directly map an IP address to a physical port. Instead, we need to follow a two-step process:

  • First, retrieve the MAC addresses of the connected devices using the switch's MAC address table.
  • Then, correlate each MAC address with its corresponding IP address by consulting the ARP table.

Let’s start by identifying the MAC addresses associated with our two physical interfaces.

  • Display the MAC address of the device connected to interface Gi1/0/1:
switch01# show mac address-table | include Gi1/0/1
   1    24b6.fd14.0853    DYNAMIC     Gi1/0/1
  • Display the MAC address of the device connected to interface Gi1/0/2:
switch01# show mac address-table | include Gi1/0/2
   1    f8db.8845.ef15    DYNAMIC     Gi1/0/2
  • Summarize the information gathered so far:
Interface mac address ip address
Gi1/0/1 24b6.fd14.0853 -
Gi1/0/2 f8db.8845.ef15 -

Retrieve the IP Addresses

  • Ping the IP addresses you want to identify in order to populate the switch’s ARP table:
switch01# ping 192.168.1.200
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.200, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/51/74 ms
switch01# ping 192.168.1.210
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.210, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 33/48/71 ms
  • Display the ARP table to correlate each MAC address with its corresponding IP address. Use the include filter to show only the relevant entry:
switch01# show arp | include 24b6.fd14.0853
Internet  192.168.1.210              0   24b6.fd14.0853  ARPA   Vlan1
switch01# show arp | include f8db.8845.ef15
Internet  192.168.1.200              0   f8db.8845.ef15  ARPA   Vlan1

Based on this output, we can conclude that the device with IP address 192.168.1.210 is connected to interface Gi1/0/1, and the device with IP address 192.168.1.200 is connected to interface Gi1/0/2.

Interface mac address ip address
Gi1/0/1 24b6.fd14.0853 192.168.1.210
Gi1/0/2 f8db.8845.ef15 192.168.1.200