由于交换机的限制以及对设备资源的合理利用,本地镜像只能做2组。
客户需求:现有三套流量分析平台需要在设备上取流,且一个流量分析平台已经做了本地端口镜像,不能动相应配置。
技术方案:多目的端口镜像配置
技术配置:
该镜像vlan只能是单独的,没有跑业务的,并且trunk口不允许该vlan通过。并且端口镜像vlan不能创建 interface vlan接口
# 创建远程源镜像组1。
<DeviceA>system-view
[DeviceA]mirroring-group 1 remote-source
# 将接入部门A、B的两个端口配置为远程源镜像组1的源端口。 源端口可以是多个或一个。
[DeviceA]mirroring-group 1 mirroring-port gigabitethernet 1/0/1 to gigabitethernet 1/0/3both #多个原端口
[DeviceA]mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both #一个原端口
# 将设备上任意未使用的端口(此处以GigabitEthernet1/0/5为例)配置为镜像组1的反射口。
[DeviceA]mirroring-group 1 reflector-port GigabitEthernet 1/0/5
# 创建VLAN10作为镜像组1的远程镜像VLAN,并将接入两台数据检测设备的端口加入VLAN10。
[DeviceA]vlan 10
[DeviceA-vlan10]port gigabitethernet 1/0/20 to gigabitethernet 1/0/22 #目的端口
[DeviceA-vlan10]quit
# 配置VLAN10作为镜像组1的远程镜像VLAN。
[DeviceA]mirroring-group 1 remote-probe vlan 10
4. 关闭反射口生成树协议
interfaceGigabitEthernet 1/0/5
undo stp enable
配置完之后出现问题,堆叠接口流量异常。然后做下流量统计,分析原因。
V7版本,配置设备的流量统计,对端口的进出数据包进行统计
配置:
System-view
acl number 3000 //匹配 源192.168.1.1,目的192.168.1.3
rule 0 permit icmp source 192.168.1.1 0 destination 192.168.1.3 0
acl number 3001 //匹配 源192.168.1.3,目的 192.168.1.1
rule 0 permit icmp source 192.168.1.3 0 destination 192.168.1.1 0
#
traffic classifier 1 operator and
if-match acl 3000
#
traffic behavior 1
accounting packet
#
traffic classifier 2 operator and
if-match acl 3001
#
traffic behavior 2
accounting packet
#
qos policy 1
classifier 1 behavior 1
#
qos policy 2
classifier 2 behavior 2
#
interface Ethernet1/0/1
qos apply policy 2 outbound //192.168.1.3→192.168.1.1出端口
qos apply policy 1 inbound //192.168.1.1→192.168.1.3进端口
#
Interface Ethernet1/0/2
qos apply policy 2 inbound //192.168.1.3→192.168.1.1进端口
qos apply policy 1 outbound //192.168.1.1→192.168.1.3出端口
#
在192.168.1.1 ping 192.168.1.3 4个包
C:WindowsSystem32>ping 192.168.1.3
正在 Ping 192.168.1.3 具有 32 字节的数据:
来自 192.168.1.3 的回复: 字节=32 时间=2ms TTL=255
来自 192.168.1.3 的回复: 字节=32 时间=1ms TTL=255
来自 192.168.1.3 的回复: 字节=32 时间=1ms TTL=255
来自 192.168.1.3 的回复: 字节=32 时间=1ms TTL=255
查看端口的统计信息结果
[H3C]dis qos policy interface Ethernet 1/0/1
Interface: Ethernet1/0/1
Direction: Inbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) : If-match acl 3000
Behavior: 1
Accounting Enable:
4 (Packets)
Direction: Outbound
Policy: 2
Classifier: 2
Operator: AND
Rule(s) : If-match acl 3001
Behavior: 2
Accounting Enable:
4 (Packets)
[H3C]dis qos policy interface Ethernet 1/0/2
Interface: Ethernet1/0/2
Direction: Inbound
Policy: 2
Classifier: 2
Operator: AND
Rule(s) : If-match acl 3001
Behavior: 2
Accounting Enable:
4 (Packets)
Direction: Outbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) : If-match acl 3000
Behavior: 1
Accounting Enable:
4 (Packets)
通过流量统计发现数据包发包数量异常,终端只发送一个包,而流量统计却是两个包,
去掉端口镜像配置之后,发现流量统计正常,查看相应配置,发现配置多配了一个interface vlan 10 ,undo interface vlan 10 之后,再看流量统计,统计数量正常
总结:切不可多配置,或者少配置一条命令。