用户环境:
汇聚采用的是思科的3650交换机,接入用的是思科的2960X交换机,现在已知一个用户的IP地址是10.130.69.7,要求找到这个用户在交换机上连接的物理接口。
查找方法:
1、首先通过show arp命令查看10.130.69.7这个IP地址对应的MAC地址是多少。如下:
SWD_Core_001#sh arp | in 10.130.69.7
Internet 10.130.69.7 0 00a8.59f7.4de0 ARPA Vlan12
2、通过过show mac address命令查看这个MAC地址是从哪个接口上来的。如下:
SWD_ACCESS_2F_001#sh mac address | in 00a8.59f7.4de0
12 00a8.59f7.4de0 DYNAMIC Gi2/0/23
3、通过上面的命令我们可以看到这个00a8.59f7.4de0这个MAC是从G2/0/23上来的。我们通过show cdp nei查看,发现G2/0/23连接的是SWA_ACCESS_2F_005,如下:
SWD_ACCESS_2F_001#sh cdp nei
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
D - Remote, C - CVTA, M - Two-port Mac Relay
Device ID Local Intrfce Holdtme Capability Platform Port ID
SWA_ACCESS_3F_001
Gig 2/1/2 150 S I WS-C2960X Gig 1/0/49
SWA_ACCESS_2F_001
Gig 2/0/21 179 S I WS-C2960X Gig 1/0/48
SWA_ACCESS_2F_004
Gig 1/0/22 147 S I WS-C2960X Gig 1/0/48
SWA_ACCESS_2F_005
Gig 2/0/23 173 S I WS-C2960X Gig 1/0/45
4、查找到SWA_ACCESS_2F_005的IP地址,并登录。再次使用show mac address查看这个MAC,结果发现这个MAC是从G1/0/46上来的。
SWD_ACCESS_2F_001#10.130.65.9
Trying 10.130.65.9 ... Open
User Access Verification
Password:
SWA_ACCESS_2F_005>en
Password:
SWA_ACCESS_2F_005#sh mac address-table | in 00a8.59f7.4de0
12 00a8.59f7.4de0 DYNAMIC Gi1/0/46
5、查看G1/0/46的配置,发现该接口是一个trunk口,于是再次使用show cdp nei查看,发现G1/0/46连接是SWA_ACCESS_2F_006。
SWA_ACCESS_2F_005#sh run int g1/0/46
Building configuration...
Current configuration : 62 bytes
!
interface GigabitEthernet1/0/46
switchport mode trunk
end
SWA_ACCESS_2F_005#sh cdp nei
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
D - Remote, C - CVTA, M - Two-port Mac Relay
Device ID Local Intrfce Holdtme Capability Platform Port ID
SWA_ACCESS_2F_008
Gig 1/0/48 166 S I WS-C2960X Gig 1/0/24
SWA_ACCESS_2F_009
Gig 1/0/44 177 S I WS-C2960X Gig 1/0/24
SWA_ACCESS_2F_006
Gig 1/0/46 122 S I WS-C2960X Gig 1/0/48
Total cdp entries displayed : 3
6、查看SWA_ACCESS_2F_006的IP地址,并登录,登录之后使用show mac address查看,显示该MAC是从G1/0/35上来的。查看G1/0/35的配置,该接口是一个普通的接入接口
SWA_ACCESS_2F_005#10.130.65.10
Trying 10.130.65.10 ... Open
User Access Verification
Password:
SWA_ACCESS_2F_006>en
Password:
SWA_ACCESS_2F_006#sh mac address-table | in 00a8.59f7.4de0
12 00a8.59f7.4de0 DYNAMIC Gi1/0/35
SWA_ACCESS_2F_006#sh run int g1/0/35
Building configuration...
Current configuration : 140 bytes
!
interface GigabitEthernet1/0/35
switchport access vlan 12
switchport mode access
switchport voice vlan 30
end
7、走到这里,我们已经查找完成了,10.130.69.7这个IP地址连接到了交换机SWA_ACCESS_2F_006的第35个口上。
说明:虽然上面的操作没有什么难度,但是在实际工作中却会经常用到。
原文地址:http://blog.51cto.com/05wylz/2319992