网络维护的时候可能经常会遇到这种情况:发现某个IP地址流量特别大,或者收发特别异常的时候,想找出该IP对应的用户出来。
而在思科交换机搭建的环境中,是能做到通过对方MAC/IP地址来查找对端对应的交换机端口的,具体步骤如下:
假设对端的MAC地址为:192.168.1.101
在中心交换机(核心层交换机或汇聚层交换机)上输入:
switch-6509#show ip arp | in 192.168.1.101
Internet 192.168.50.47 2 0011.2233.4455 ARPA Vlan50
在ARP表中我们找到了和192.168.1.101对应的MAC地址,如果要根据MAC地址查找对应交换机端口,可从下面开始操作。
switch-6509#show mac address-table | in 0011.2233.4455
Mac Address Table
——————————————-
Vlan Mac Address Type Ports
—- ———– ——– —–
120 0011.2233.4455 DYNAMIC Gi1/0/3
Total Mac Addresses for this criterion: 1
可以在MAC地址表中发现MAC地址0011.2233.4455是从端口G1/0/3学习过来的,继续向下层排查。
switch-6509#show cdp nei g1/0/3 detail
Device ID: IDC-2960G48-A14-114
Entry address(es):
IP address: 192.168.1.102
Platform: cisco WS-C2960G-48TC-L, Capabilities: Switch IGMP
Interface: GigabitEthernet1/0/3, Port ID (outgoing port): GigabitEthernet0/48
Holdtime : 120 sec
Version :
Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, REL
EASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2010 by Cisco Systems, Inc.
Compiled Tue 28-Sep-10 13:44 by prod_rel_team
advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=0000000
0FFFFFFFF010221FF000000000000B8BEBF549D00FF0000
VTP Management Domain: ”
Native VLAN: 1
Duplex: full
Management address(es):
IP address: 192.168.1.102
我们发现下层连接的是2960的接入层交换机,登陆到此交换机。
switch-2960#show mac address-table | in 0011.2233.4455
Mac Address Table
——————————————-
Vlan Mac Address Type Ports
—- ———– ——– —–
120 0011.2233.4455 DYNAMIC Fa1/0/30
Total Mac Addresses for this criterion: 1
即可发现该MAC/IP地址所对应的端口是2960交换机的f1/0/30口,若继续通过跳线追查可以发现该用户的具体位置。