rss logo

How to know the ip address of the device connected to a physical interface

Cisco logo

In this article, we'll look at how to map a device's IP address to the physical interface of a Cisco switch.

Network Architecture

Let's assume that we're in the case of the architecture below, and that we want to know which IP addresses are connected to interfaces Gi1/0/1 and Gi1/0/2.

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.

Match IP addresses to physical ports

Set an IP address for the switch

Note: The switch address(es) must be in the same vlan as the devices to be identified. In this example, all devices to be identified are in vlan 1.
  • Configure vlan 1 interface:
switch01(config)# interface vlan 1 switch01(config-if)# ip address 192.168.1.1 255.255.255.0 switch01(config-if)# no shutdown

Get mac addresses

As explained above, switches are Layer 2 devices, so there's no way to retrieve this information with a single command. We must therefore first retrieve the mac addresses of the devices and then search inside the arp table for the correspondence between the mac address and the IP address.

Let's see how to display the mac addresses connected to our two physical ports.

  • 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
  • Note the informations retrieved:
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 we wish to identify in ordre 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 obtain the correspondence between the IP address and the mac address (use the “include” instruction to display only the line corresponding to our mac address):
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

We can deduce from this information that the device with IP address 192.168.1.210 is connected to interface Gi1/0/1 and that 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
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address