一、本地端口镜像配置实例
1. 组网需求
某公司内部通过交换机实现各部门之间的互连,网络环境描述如下:
<1>研发部通过端口Ethernet 1/0/1接入Switch C;
<2>市场部通过端口Ethernet 1/0/2接入Switch C;
<3>数据监测设备连接在Switch C的Ethernet 1/0/3端口上。
网络管理员希望通过数据监测设备对研发部和市场部收发的报文进行监控。

使用本地端口镜像功能实现该需求,在Switch C上进行如下配置:
<1>端口Ethernet 1/0/1和Ethernet 1/0/2为镜像源端口;
<2>连接数据监测设备的端口Ethernet 1/0/3为镜像目的端口。

2.组网图

图1配置本地端口镜像组网图

3.配置步骤
配置Switch C:
# 创建本地镜像组。
<SwitchC> system-view
[SwitchC] mirroring-group 1 local
# 为本地镜像组配置源端口和目的端口。
[SwitchC] mirroring-group 1 mirroring-port Ethernet 1/0/1 Ethernet 1/0/2 both
[SwitchC] mirroring-group 1 monitor-port Ethernet 1/0/3

# 显示所有镜像组的配置信息。
[SwitchC] display mirroring-group all
mirroring-group 1:
type: local
status: active
mirroring port:
Ethernet1/0/1 both
Ethernet1/0/2 both
monitor port: Ethernet1/0/3

配置完成后,用户就可以在Server上监控部门1和部门2收发的所有报文。

二、远程端口镜像配置
1.组网需求
某公司内部通过交换机实现各部门之间的互连,网络环境描述如下:
<1>Switch A、Switch B和Switch C都为S3610&S5510系列以太网交换机;
<2>部门1通过端口Ethernet 1/0/1接入Switch A;
<3>部门2通过端口Ethernet 1/0/2接入Switch A;
<4>Switch A的端口Ethernet 1/0/3和Switch B的端口Ethernet 1/0/1相连;
<5>Switch B的端口Ethernet 1/0/2和Switch C的端口Ethernet 1/0/1相连;
<6>数据监测设备连接在Switch C的Ethernet 1/0/2端口上。

网络管理员希望通过数据监测设备对部门1和部门2发送的报文进行监控。

使用远程端口镜像功能实现该需求,进行如下配置:
<1>Switch A充当源设备,Switch B充当中间设备,Switch C充当目的设备;
<2>在Switch A上配置远程源镜像组,定义VLAN 2为远程镜像VLAN,端口Ethernet 1/0/1和Ethernet 1/0/2为镜像源端口,端口Ethernet 1/0/4为反射端口;
<3>配置Switch A的端口Ethernet 1/0/3、Switch B的端口Ethernet 1/0/1和Ethernet 1/0/2、Switch C的端口Ethernet1/0/1的端口类型为Trunk端口,并且都允许VLAN 2的报文通过;
<4>在Switch C上配置远程目的镜像组,定义VLAN 2为远程镜像VLAN,连接数据监测设备的端口Ethernet 1/0/2为镜像目的端口。
2.组网图
 
图2配置远程端口镜像组网图

3.配置步骤
(1) 配置Switch A:
# 创建远程源镜像组。
<SwitchA> system-view
[SwitchA] mirroring-group 1 remote-source
# 创建VLAN 2。
[SwitchA] vlan 2
[SwitchA-vlan2] quit

# 为远程源镜像组配置远程镜像VLAN、源端口和反射端口。
[SwitchA] mirroring-group 1 remote-probe vlan 2
[SwitchA] mirroring-group 1 mirroring-port Ethernet 1/0/1 Ethernet 1/0/2 inbound
[SwitchA] mirroring-group 1 reflector-port Ethernet 1/0/4

# 配置端口Ethernet 1/0/3的端口类型为Trunk端口,允许VLAN 2的报文通过。
[SwitchA] interface Ethernet 1/0/3
[SwitchA-Ethernet1/0/3] port link-type trunk
[SwitchA-Ethernet1/0/3] port trunk permit vlan 2

(2) 配置Switch B:
# 配置端口Ethernet 1/0/1的端口类型为Trunk端口,允许VLAN 2的报文通过。
<SwitchB> system-view
[SwitchB] interface Ethernet 1/0/1
[SwitchB-Ethernet1/0/1] port link-type trunk
[SwitchB-Ethernet1/0/1] port trunk permit vlan 2
[SwitchB-Ethernet1/0/1] quit

# 配置端口Ethernet 1/0/2的端口类型为Trunk端口,允许VLAN 2的报文通过。
[SwitchB] interface Ethernet 1/0/2
[SwitchB-Ethernet1/0/2] port link-type trunk
[SwitchB-Ethernet1/0/2] port trunk permit vlan 2

(3) 配置Switch C:
# 配置端口Ethernet 1/0/1的端口类型为Trunk端口,允许VLAN 2的报文通过。
<SwitchC> system-view
[SwitchC] interface Ethernet 1/0/1
[SwitchC-Ethernet1/0/1] port link-type trunk
[SwitchC-Ethernet1/0/1] port trunk permit vlan 2
[SwitchC-Ethernet1/0/1] quit

# 创建远程目的镜像组。
[SwitchC] mirroring-group 1 remote-destination
# 创建VLAN 2。
[SwitchC] vlan 2
[SwitchC-vlan2] quit

# 为远程目的镜像组配置远程镜像VLAN和目的端口。
[SwitchC] mirroring-group 1 remote-probe vlan 2
[SwitchC] mirroring-group 1 monitor-port Ethernet 1/0/2

配置完成后,用户就可以在数据监测设备上监控部门1和部门2发送的所有报文。