端口镜像操作(华为)

端口镜像可以是:本地端口镜像、远程端口镜像。

本地端口镜像

  1. 设置观察端口:
SwitchA> sys
SwitchA] observe-port 1 interface Ethernet 0/0/47 cr

上面的命令,将Ethernet 0/0/47 设置为观察端口,其中的1是指观察索引号,只能设置4个的观察端口(Huawei Versatile Routing Platform Software(VRP) Version 5.70)。

  1. 设置镜像端口
SwitchA> sys
SwitchA] interface Ethernet 0/0/36
SwitchA-Ethernet0/0/36] port-mirroring to observe-port 1 inbound/outbound/both cr

需要先进入接口模式,然后执行以上的port-mirroring命令,其中的1是第一步设置的观察索引号,inbound/outbound/both是指:上传流量、下载流量与全部流量。

需要注意的是:在上面两个接口中,Ethernet 0/0/47是接入监测设备的端口,而Ethernet 0/0/36是被监测的端口;检测设备网卡要打开混杂模式($sudo ifconfig enp2s0 promisc, 关闭混杂模式: $sudo ifconfig enp2s0 -promisc);

远程的端口镜像

远程的端口镜像,是在本地端口镜像操作基础上,将观察端口(也就是上述本地端口镜像中的Ethernet 0/0/47)放到一个特别的镜像用Vlan中,并在本地交换机、核心交换机及观察端口所在交换机的中继端口上允许该Vlan通过,并将远端交换机上的观察端口,置为access模式,放在镜像用Vlan上即可。

Last change: 2023-03-27, commit: 2e80684