搜档网
当前位置:搜档网 › 华为 端口镜像配置命令

华为 端口镜像配置命令

镜像有很多种 基于接口的 基于VLAN 基于MAC的 基于流(ACL)的
这里主要介绍基于VLAN的




配置基于接口的本地镜像



查看接口镜像信息列表
display port-mirroring

查看观察端口的使用情况
display observe-port



背景信息

配置镜像的接口可以是物理接口,也可以是Eth-Trunk接口。
若镜像端口为Eth-trunk类型,需要预先使用命令interface eth-trunk trunk-id创建Eth-trunk。
若已经配置Eth-trunk为镜像端口,则不能再单独配置其成员接口为镜像端口。
若已经配置Eth-trunk下某成员接口为镜像端口,则不能再配置Eth-trunk为镜像端口。



操作步骤

执行命令system-view,进入系统视图。
执行命令observe-port index interface interface-type interface-number
配置观察接口。
执行命令interface interface-type interface-number
进入镜像接口的接口视图。
执行命令port-mirroring to observe-port index { both | inbound | outbound }
配置接口镜像。


当需要同时监控多个接口的入方向或出方向的报文时,可以重复执行步骤3和步骤4。


说明:
配置S5300SI和S5300LI设备时,同一个端口的出方向上不能同时配置为观察端口和镜像端口。




例子


配置步骤
1. 在Switch上创建VLAN,把相应接口以Trunk方式加入VLAN
# 将接口Ethernet0/0/1和Ethernet0/0/3以Trunk方式加入同一VLAN。(以下配置以接口Ethernet0/0/1为例,同理配置接口Ethernet0/0/3)
system-view
[Switch] vlan 10
[Switch-vlan10] quit
[Switch] interface ethernet 0/0/1
[Switch-Ethernet0/0/1] port link-type trunk
[Switch-Ethernet0/0/1] port trunk allow-pass vlan 10
[Switch-Ethernet0/0/1] quit

2. 配置观察接口
# 将Ethernet0/0/24接口配置为观察接口。
system-view
[Switch] observe-port 1 interface ethernet 0/0/24

3. 配置镜像接口
# 将Ethernet0/0/1接口配置为镜像接口。
[Switch] interface ethernet 0/0/1
[Switch-Ethernet0/0/1] port-mirroring to observe-port 1 inbound


4. 检查配置结果
# 执行display port-mirroring命令查看观察接口和镜像接口的配置情况。
[Switch] display port-mirroring
Port-mirror:
----------------------------------------------------------------------
Mirror-port Direction Observe-port
----------------------------------------------------------------------
Ethernet0/0/1 Inbound Ethernet0/0/24
----------------------------------------------------------------------
















配置基于接口的远程镜像

背景信息

配置镜像的接口可以是物理接口,也可以是Eth-Trunk接口。
若镜像端口为Eth-trunk类型,需要预先使用命令interface eth-trunk trunk-id创建Eth-trunk。
若已经配置Eth-trunk为镜像端口,则不能再单独配置其成员接口为镜像端口。
若已经配置Eth-trunk下某成员接口为镜像端口,

则不能再配置Eth-trunk为镜像端口。
说明:
配置S5300SI和S5300LI设备时,同一个端口的出方向上不能同时配置为观察端口和镜像端口。



操作步骤

在Source Switch设备上配置需要远程镜像的接口和远程镜像VLAN
说明:
镜像端口不允许加入到远程镜像VLAN。
执行命令system-view,进入系统视图。
执行命令vlan vlan-id,创建RSPAN VLAN并进入VLAN视图。
执行命令mac-address learning disable,关闭MAC地址学习功能。
说明:如果在此VLAN上关闭了MAC地址的学习功能,则不能在该VLAN上配置其它业务。
执行命令quit返回系统视图。
执行命令observe-port index interface interface-type interface-number [ vlan vlan-id ],配置观察接口并指定远程镜像VLAN。
执行命令interface interface-type interface-number,进入远程镜像接口的接口视图。
执行命令port-mirroring to observe-port index { both | inbound | outbound },配置接口镜像。
当需要同时监控多个接口的入方向或出方向的报文时,可以重复执行步骤6和步骤7。

在Intermediate Switch设备上配置远程镜像VLAN和远程镜像VLAN的接口属性
说明:镜像端口不允许加入到远程镜像VLAN。在Intermediate Switch设备上进行如下配置,其中Intermediate Switch与Source Switch和Destination Switch连接的接口的配置相同。如果没有Intermediate Switch则取消该步骤配置。

执行命令system-view,进入系统视图。
执行命令vlan vlan-id,创建远程镜像VLAN并进入VLAN视图。
执行命令quit返回系统视图。
执行命令interface interface-type interface-number,进入Intermediate Switch与Source Switch和Destination Switch连接的接口的接口视图。
执行命令port link-type trunk将接口的链路类型配置为Trunk。
执行命令port trunk allow-pass vlan vlan-id,配置接口加入RSPAN VLAN。
执行命令quit返回系统视图。
在Destination Switch设备上配置远程镜像的观察接口
执行命令system-view,进入系统视图。
执行命令vlan vlan-id,创建远程镜像VLAN并进入VLAN视图。
执行命令quit返回系统视图。
执行命令interface interface-type interface-number,进入Intermediate Switch和Destination Switch连接的接口的接口视图。
说明:如果没有Intermediate Switch设备,此时进入Source Switch与Destination Switch连接的接口的接口视图。
执行命令port link-type trunk将接口的链路类型配置为Trunk。
执行命令port trunk allow-pass vlan vlan-id,配置接口加入RSPAN VLAN。
执行命令interface interface-type interface-number,进入观察接口的接口视图。
执行命令port hybrid untagged vlan vlan-id,将观察接口配置为Hybrid类型并允许远端镜像VLAN的报文通过。
执行命令quit返回系统视图。



例子


配置步骤
1. 在SwitchA上完成如下配置:
#配置RSPA

N VLAN。
system-view
[SwitchA] vlan 2
[SwitchA-vlan2]mac-address learning disable 说明:如果在此VLAN上关闭了MAC地址的学习功能,则不能在该VLAN上配置其它业务。
[SwitchA-vlan2] quit
# 配置Eth0/0/1接口为观察接口,并指定RSPAN VLAN的编号为2。
[SwitchA] observe-port 1 interface ethernet 0/0/1 vlan 2
# 配置将Eth0/0/1以Trunk方式加入RSPAN VLAN。
[SwitchA] interface ethernet 0/0/1
[SwitchA-Ethernet0/0/1] port link-type trunk
[SwitchA-Ethernet0/0/1] port trunk allow-pass vlan 2
[SwitchA-Ethernet0/0/1] quit
# 在Eth0/0/2接口入方向上配置远程接口镜像。
[SwitchA] interface ethernet 0/0/2
[SwitchA-Ethernet0/0/2] port-mirroring to observe-port 1 inbound
[SwitchA-Ethernet0/0/2] quit

2. 在SwitchB上完成如下配置:
# 创建RSPAN VLAN。
system-view
[SwitchB] vlan 2
[SwitchB-vlan2] quit
# 配置将Eth0/0/1和Eth0/0/2以Trunk方式加入RSPAN VLAN。
[SwitchB] interface Ethernet 0/0/1
[SwitchB-Ethernet0/0/1] port link-type trunk
[SwitchB-Ethernet0/0/1] port trunk allow-pass vlan 2
[SwitchB-Ethernet0/0/1] quit
[SwitchB] interface Ethernet 0/0/2
[SwitchB-Ethernet0/0/2] port link-type trunk
[SwitchB-Ethernet0/0/2] port trunk allow-pass vlan 2
[SwitchB-Ethernet0/0/2] quit

3. 在SwitchC上完成如下配置:
# 创建RSPAN VLAN。
system-view
[SwitchC] vlan 2
[SwitchC-vlan2] quit
# 配置将Eth0/0/2以Trunk方式加入RSPAN VLAN。
[SwitchC] interface Ethernet 0/0/2
[SwitchC-Ethernet0/0/2] port link-type trunk
[SwitchC-Ethernet0/0/2] port trunk allow-pass vlan 2
[SwitchC-Ethernet0/0/2] quit
# 配置将Eth0/0/1配置为Hybrid类型并允许远端镜像VLAN的报文通过。
[SwitchC] interface Ethernet 0/0/1
[SwitchC-Ethernet0/0/1] port hybrid untagged vlan 2
[SwitchC-Ethernet0/0/1] quit






配置文件
SwitchA的配置文件。
#
sysname SwitchA
#
vlan 2
#
observe-port 1 interface Ethernet0/0/1 vlan 2
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/2
port-mirroring to observe-port 1 inbound
#
#
return
SwitchB的配置文件。
#
sysname SwitchB
#
vlan 2
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2
#
#
return
SwitchC的配置文件。
#
sysname SwitchC
#
vlan 2
#
interface Ethernet0/0/1
port hybrid untagged vlan 2
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2
#
#
return







相关主题