工作需求:通过mac地址查找PC3位于那个接入层交换机上
拓扑图如下:
#在核心交换机上查找该mac地址对应的IP地址,属于那个VLAN,从哪个接口学习到的MAC地址信息。
<COREA>dis arp | include 5489-9810-380d
ARP Entry Types: D - Dynamic, S - Static, I - Interface, O - OpenFlow, RD - Redi
rect
EXP: Expire-time VLAN:VLAN or Bridge Domain
IP ADDRESS MAC ADDRESS EXP(M) TYPE/VLAN INTERFACE VPN-INSTA
NCE
--------------------------------------------------------------------------------
--------
192.168.100.100 5489-9810-380d 19 D/100 GE1/0/2
--------------------------------------------------------------------------------
--------
Total:8 Dynamic:5 Static:0 Interface:3 OpenFlow:0
Redirect:0
(可选)继续通过命令display mac-address interface GE 1/0/2查找该MAC地址对应的端口号。发现380d是通过GE1/0/2口进来。
<COREA>display mac-address interface GE 1/0/2
Flags: * - Backup
BD : bridge-domain Age : dynamic MAC learned time in seconds
-------------------------------------------------------------------------------
MAC Address VLAN/VSI/BD Learned-From Type Age
-------------------------------------------------------------------------------
5489-9810-380d 100/-/- GE1/0/2 dynamic -
5489-9810-380d 100/-/- GE1/0/2 dynamic -
-------------------------------------------------------------------------------
Total items: 2
核心交换机COREA上执行命令display mac-address,发现380d是通过GE1/0/2口进来。
[~COREA]dis mac-address
Flags: * - Backup
BD : bridge-domain Age : dynamic MAC learned time in seconds
-------------------------------------------------------------------------------
MAC Address VLAN/VSI/BD Learned-From Type Age
-------------------------------------------------------------------------------
707b-e8a1-332c 10/-/- Eth-Trunk1 dynamic -
707b-e8a1-332c 20/-/- Eth-Trunk1 dynamic -
707b-e8a1-332c 100/-/- Eth-Trunk1 dynamic -
5489-9814-56ea 10/-/- GE1/0/2 dynamic -
5489-9810-380d 100/-/- GE1/0/2 dynamic -
707b-e8a1-332c 10/-/- Eth-Trunk1 dynamic -
707b-e8a1-332c 20/-/- Eth-Trunk1 dynamic -
707b-e8a1-332c 100/-/- Eth-Trunk1 dynamic -
5489-9814-56ea 10/-/- GE1/0/2 dynamic -
5489-9810-380d 100/-/- GE1/0/2 dynamic -
-------------------------------------------------------------------------------
Total items: 10
通过查看GE1/0/2口,发现这是一个下级联端口,此接口的描述提示连接到HUIJ01,然后到汇聚HUIJ01上继续排查。
<COREA>dis interface GE 1/0/2
GE1/0/2 current state : UP (ifindex: 7)
Line protocol current state : UP
Description: TO_HUIJ01
Switch Port, PVID : 1, TPID : 8100(Hex), The Maximum Frame Length is 9216
Internet protocol processing : disabled
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 707b-e8ef-56b3
Last physical up time : 2021-08-01 09:02:51
Last physical down time : 2021-08-01 09:02:31
Current system time: 2021-08-01 10:07:18
在汇聚交换机HUIJ01上执行命令 display mac-address
<HUIJ01>dis mac-address
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
0000-5e00-010a 100 - - GE0/0/2 dynamic 0/-
0000-5e00-010a 10 - - GE0/0/2 dynamic 0/-
0000-5e00-0114 20 - - GE0/0/2 dynamic 0/-
707b-e8ef-56b3 10 - - GE0/0/2 dynamic 0/-
707b-e8ef-56b3 20 - - GE0/0/2 dynamic 0/-
707b-e8ef-56b3 100 - - GE0/0/2 dynamic 0/-
5489-9810-380d 100 - - GE0/0/4 dynamic 0/-
5489-9814-56ea 10 - - GE0/0/1 dynamic 0/-
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 8
在汇聚交换机上查到380d是连接在当前交换机的GE0/0/4口上,属于VLAN100,此接口是与SW1交换机连接的中继端口。现在大致知道终端是连到那个接入层交换机,即SW1接入层交换机。
现在到SW1交换机上继续排查,发现终端是连接到GE0/0/1端口上。这样最终就能定位到了是那台主机连接到这个端口。
[SW1]dis mac-address
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
0000-5e00-010a 100 - - GE0/0/4 dynamic 0/-
5489-9810-380d 100 - - GE0/0/1 dynamic 0/-
707b-e8ef-56b3 100 - - GE0/0/4 dynamic 0/-
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 3