Find the interface based on MAC or IP address on Cisco Switch (Cisco IOS)

Here are the sample steps on finding the interface where the host is connected based on IP address or MAC address on Cisco Catalyst L3 Switch running on Cisco IOS

Scenario 1: IP address is given, find which interface it is connected
IP address: 192.168.0.35

a. Find the routing entry for the IP to know where it is connected

show ip route <IP>

SWITCH1#show ip route 192.168.0.35
Routing entry for 192.168.0.32/29
Known via “connected”, distance 0, metric 0 (connected, via interface)
Routing Descriptor Blocks:
* directly connected, via Vlan888
Route metric is 0, traffic share count is 1
SWITCH1#

Note: From the output above, we found out that is routed via VLAN 888

b. Show the arp for the interface

show ip arp <interface>

SWITCH1#show ip arp Vlan888
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.0.35 0 d444.e555.f666 ARPA Vlan888
Internet 192.168.0.34 0 a111.b222.c333 ARPA Vlan888
SWITCH1#

Note: From the output above, we found out that the IP 192.168.15.35 mac address is d444.e555.f666 , now we need to find now where the interface it is connected.

c. Show the mac address table

show mac address-table address <MAC address>

SWITCH1#show mac address-table address d444.e555.f666
Unicast Entries
vlan mac address type protocols port
———+—————+——–+———————+————————-
888 d444.e555.f666 dynamic ip,ipx,assigned,other GigabitEthernet1/7

Note: From the output above, we found out that mac address is mapped or learned from GigabitEthernet1/7

d.  Verify the interface

show run interface <interface>

SWITCH1#show run int GigabitEthernet1/7
Building configuration…

Current configuration : 214 bytes
!
interface GigabitEthernet1/7
description FE Conn to Server#1
switchport access vlan 888
switchport mode access
load-interval 30
spanning-tree portfast
spanning-tree guard root
end

Scenario 2: MAC address is given, it is pretty straightforward to find where is being learned by what interface
MAC address: a111.b222.c333

show mac address-table address <MAC address>

SWITCH1#show mac address-table address a111.b222.c333
Unicast Entries
vlan mac address type protocols port
———+—————+——–+———————+————————-
888 a111.b222.c333 dynamic ip,ipx,assigned,other GigabitEthernet1/3

Be First to Comment

Leave a Reply

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