In this article, we'll look at how to map the ip address of a device to the physical interface of a Cisco switch.
Let's suppose we're in the case of the architecture below and we want to know which IP addresses are connected to interfaces Gi1/0/1 and Gi1/0/2.
switch01(config)# interface vlan 1
switch01(config-if)# ip address 192.168.1.1 255.255.255.0
switch01(config-if)# no shutdown
As explained above, switches are Layer 2 devices, so there's no way to retrieve this information directly with a single command; we first need to obtain the mac addresses of our devices, then search for them in the arp table.
So let's take a look at how to retrieve mac addresses connected to these two physical ports.
switch01# show mac address-table | include Gi1/0/1
1 24b6.fd14.0853 DYNAMIC Gi1/0/1
switch01# show mac address-table | include Gi1/0/2
1 f8db.8845.ef15 DYNAMIC Gi1/0/2
Interface | mac address | ip address |
---|---|---|
Gi1/0/1 | 24b6.fd14.0853 | - |
Gi1/0/2 | f8db.8845.ef15 | - |
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
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 now deduce from this information that device 192.168.1.210 is connected to interface Gi1/0/1 and device 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 |
Contact :