Locate the switchport where the host is connected to (Cisco CatOS and IOS)
In a forest of Cisco Switches, sometimes it
is hard to locate which switch port the host/PC is connected to. I have
summarize the command needed to perform the task on a Cisco CatOS switch and a
Cisco IOS switch.
1. Find the MAC address of the target PC
first
C:\>ping pc-hostname
Pinging pc-hostname [192.168.11.49] with 32 bytes of data:
Pinging pc-hostname [192.168.11.49] with 32 bytes of data:
Reply from 192.168.11.49: bytes=32
time<1ms TTL=128
Reply from 192.168.11.49: bytes=32
time<1ms TTL=128
Ping statistics for 192.168.11.49:
Packets: Sent = 2,
Received = 2, Lost = 0 (0% loss),
Approximate round trip times in
milli-seconds:
Minimum = 0ms, Maximum =
0ms, Average = 0ms
Control-C
^C
C:\>arp -a | findstr "192.168.11.49"
10.68.11.49
00-aa-bb-cc-dd-ee dynamic
2. CatOS: find the connection port
C:\>telnet my_sw1
Cisco Systems Console
Welcome to MY_SW1
Enter password:
MY_SW1> en
Enter password:
MY_SW1> (enable) show cam 00-aa-bb-cc-dd-ee
* = Static Entry. + = Permanent Entry. # =
System Entry. R = Router Entry.
X = Port Security Entry $ = Dot1x Security
Entry
VLAN Dest MAC/Route
Des [CoS] Destination Ports or VCs / [Protocol Type]
----
------------------ -----
-------------------------------------------
3 00-aa-bb-cc-dd-ee
3/8 [ALL]
Total Matching CAM Entries Displayed =1
MY_SW1> (enable) show cdp neighbors 3/8
* - indicates vlan mismatch.
# - indicates duplex mismatch.
Port
Device-ID
Port-ID
Platform
-------- -------------------------------
------------------------- ------------
3/8
MY_SW7
GigabitEthernet0/1 cisco WS-C3560-24TS
MY_SW1> (enable)quit
3. The PC is connected at
MY_SW7. Let's go to MY_SW7 to find the exact port:
C:\>telnet my_sw7
User Access Verification
Password:
MY_SW7>en
Password: Welcome to MY_SW7
MY_SW7#show mac-address-table address 00-aa-bb-cc-dd-ee
Mac Address Table
-------------------------------------------
Vlan Mac Address
Type Ports
----
----------- --------
-----
3
00aa.bbcc.ddee DYNAMIC Fa0/13
Total Mac Addresses for this criterion: 1
MY_SW7#show interfaces Fa0/13
FastEthernet0/13 is up, line protocol is up
(connected)
Hardware is Fast Ethernet, address is
00ff.eedd.bbaa (bia 00ff.eedd.bbaa)
MTU 1500 bytes, BW 100000 Kbit, DLY
100 usec,
reliability 255/255,
txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, media type is
10/100BaseTX
input flow-control is off, output
flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:01,
output hang never
Last clearing of "show
interface" counters never
Input queue: 0/75/0/0
(size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 50000 bits/sec, 11
packets/sec
5 minute output rate 125000 bits/sec,
19 packets/sec
17009916 packets
input, 2224460537 bytes, 0 no buffer
Received 49139
broadcasts (0 multicast)
0 runts, 0 giants, 0
throttles
1 input errors, 0
CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 28
multicast, 0 pause input
0 input packets with
dribble condition detected
53834839 packets
output, 3153486266 bytes, 0 underruns
0 output errors, 8
collisions, 2 interface resets
0 babbles, 35 late
collision, 0 deferred
0 lost carrier, 0 no
carrier, 0 PAUSE output
0 output buffer failures,
0 output buffers swapped out
Comments