H3C网管交换机多端口 ARP 表项配置举例

一、 组网需求
• Device 连接服务器群,通过属于 VLAN 10 的三个二层接口 GigabitEthernet1/0/1、
GigabitEthernet1/0/2 和 GigabitEthernet1/0/3 分别连接三台服务器。
• 服务器群的共享 IP 地址为 192.168.1.1/24,共享 MAC 地址为 00e0-fc01-0000。
配置多端口 ARP 表项,使目的 IP 为 192.168.1.1 的 IP 数据报文能同时发送到三台服务器上。

二、组网图
多端口 ARP 表项配置组网图

三、配置步骤
在 Device 上进行下列配置。
# 创建 VLAN 10。
<Device> system-view
[Device] vlan 10
[Device-vlan10] quit

# 将接口 GigabitEthernet1/0/1、GigabitEthernet1/0/2、GigabitEthernet1/0/3 加入到 VLAN 10 中。
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] port access vlan 10
[Device-GigabitEthernet1/0/1] quit
[Device] interface gigabitethernet 1/0/2
[Device-GigabitEthernet1/0/2] port access vlan 10
[Device-GigabitEthernet1/0/2] quit
[Device] interface gigabitethernet 1/0/3
[Device-GigabitEthernet1/0/3] port access vlan 10
[Device-GigabitEthernet1/0/3] quit

# 创建接口 Vlan-interface10,并配置 IP 地址。
[Device] interface vlan-interface 10
[Device-vlan-interface10] ip address 192.168.1.2 24
[Device-vlan-interface10] quit

# 配置多端口单播 MAC 表项,MAC 地址为 00e0-fc01-0000,对应的出接口为 GigabitEthernet1/0/1、
GigabitEthernet1/0/2 和 GigabitEthernet1/0/3,接口属于 VLAN 10。
[Device] mac-address multiport 00e0-fc01-0000 interface gigabitethernet 1/0/1 to
gigabitethernet 1/0/3 vlan 10

# 配置一条多端口 ARP 表项,IP 地址为 192.168.1.1,对应的 MAC 地址为 00e0-fc01-0000。
[Device] arp multiport 192.168.1.1 00e0-fc01-0000 10

# 查看 ARP 表项信息。
[Device] display arp
查看 ARP 表项信息

H3C网管交换机短静态 ARP 表项配置举例

一、 组网需求
• Device B 通过接口 GigabitEthernet1/0/1 连接主机,通过接口 GigabitEthernet1/0/2 连接Device A。
• Device A 的 IP 地址为 192.168.1.1/24,MAC 地址为 00e0-fc01-001f。
网络管理员需要通过某种方法来防止恶意用户对 Device B 进行 ARP 攻击,增加 Device B 和 Device A 通信的安全性。如果 Device A 的 IP 地址和 MAC 地址是固定的,则可以通过在 Device B 上配置静态 ARP 表项的方法,防止恶意用户进行 ARP 攻击。

二、组网图
短静态 ARP 表项配置组网图

三、配置步骤
在 Device B 上进行下列配置。
# 在接口 GigabitEthernet1/0/2 配置 IP 地址。
<DeviceB> system-view
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] ip address 192.168.1.2 24
[DeviceB-GigabitEthernet1/0/2] quit
# 配置一条短静态 ARP 表项,IP 地址是 192.168.1.1,对应的 MAC 地址是 00e0-fc01-001f。
[DeviceB] arp static 192.168.1.1 00e0-fc01-001f
# 查看短静态 ARP 表项信息。
[DeviceB] display arp static
查看短静态 ARP 表项信息

H3C网管交换机长静态 ARP 表项配置举例

一、 组网需求
• Device B 连接主机,通过接口 GigabitEthernet1/0/1 连接 Device A。接口
GigabitEthernet1/0/1 属于 VLAN 10。
• Device A 的 IP 地址为 192.168.1.1/24,MAC 地址为 00e0-fc01-0000。
为了增加 Device B 和 Device A 通信的安全性,可以在 Device B 上为 Device A 配置一条静态 ARP表项,从而防止攻击报文修改此表项的 IP 地址和 MAC 地址的映射关系。

二、组网图
长静态 ARP 表项配置组网图

三、配置步骤
在 Device B 上进行下列配置。
# 创建 VLAN 10。
system-view
[DeviceB] vlan 10
[DeviceB-vlan10] quit

# 将接口 GigabitEthernet1/0/1 加入到 VLAN 10 中。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] port access vlan 10
[DeviceB-GigabitEthernet1/0/1] quit

# 创建接口 Vlan-interface10,并配置 IP 地址。
[DeviceB] interface vlan-interface 10
[DeviceB-vlan-interface10] ip address 192.168.1.2 8
[DeviceB-vlan-interface10] quit

# 配置一条长静态 ARP 表项,IP 地址为 192.168.1.1,对应的 MAC 地址为 00e0-fc01-0000,此条ARP 表项对应的出接口为属于 VLAN 10 的接口 GigabitEthernet1/0/1。
[DeviceB] arp static 192.168.1.1 00e0-fc01-0000 10 gigabitethernet 1/0/1

# 查看长静态 ARP 表项信息。
[DeviceB] display arp static
查看长静态 ARP 表项信息

H3C网管交换机DHCP Snooping 支持 Option 82 配置举例

一、 组网需求
•Switch B 上开启 DHCP Snooping 功能,并支持 Option 82 功能;
• 对包含 Option 82 的请求报文的处理策略为 replace;
• 在 GigabitEthernet1/0/2 上配置 Circuit ID 填充内容为 company001,Remote ID 填充内容为device001;
• 在 GigabitEthernet1/0/3 上配置 Circuit ID 以 verbose 模式填充,接入节点标识为 sysname,填充格式为 ASCII 格式,Remote ID 填充内容为 device001;

二、组网图
DHCP Snooping 支持 Option 82 配置示意图

三、配置步骤
# 开启 DHCP Snooping 功能。
<SwitchB> system-view
[SwitchB] dhcp snooping enable

# 设置 GigabitEthernet1/0/1 端口为信任端口。
[SwitchB] interface gigabitethernet 1/0/1
[SwitchB-GigabitEthernet1/0/1] dhcp snooping trust
[SwitchB-GigabitEthernet1/0/1] quit

# 在 GigabitEthernet1/0/2 上配置 DHCP Snooping 支持 Option 82 功能。
[SwitchB] interface gigabitethernet 1/0/2
[SwitchB-GigabitEthernet1/0/2] dhcp snooping information enable
[SwitchB-GigabitEthernet1/0/2] dhcp snooping information strategy replace
[SwitchB-GigabitEthernet1/0/2] dhcp snooping information circuit-id string company001
[SwitchB-GigabitEthernet1/0/2] dhcp snooping information remote-id string device001
[SwitchB-GigabitEthernet1/0/2] quit

四、验证配置
配置完成后,使用 display dhcp snooping information 命令可查看到 DHCP Snooping 在端口GigabitEthernet1/0/2 和 GigabitEthernet1/0/3 上 Option 82 的配置信息。

H3C网管交换机按 VLAN 开启 DHCP Snooping 配置举例

一、 组网需求
•Switch B 通过以太网端口 GigabitEthernet1/0/1 连接到合法 DHCP 服务器,通过以太网端口GigabitEthernet1/0/3 连接到非法 DHCP 服务器,通过 GigabitEthernet1/0/2 连接到 DHCP 客户端。
要求:
• VLAN 100 上与合法 DHCP 服务器相连的端口可以转发 DHCP 服务器的响应报文,而其他端口不转发 DHCP 服务器的响应报文。
• 记录 DHCP-REQUEST 报文和信任端口收到的 DHCP-ACK 报文中 DHCP 客户端 IP 地址及MAC 地址的绑定信息。

二、组网图
按 VLAN 开启 DHCP Snooping 配置组网示意图

三、配置步骤
# 配置端口 GigabitEthernet1/0/1、GigabitEthernet1/0/2 和 GigabitEthernet1/0/3 为 Access 端口,
允许 VLAN 100 通过。
<SwitchB> system-view
[SwitchB] vlan 100
[SwitchB-vlan100] port gigabitethernet 1/0/1 to gigabitethernet 1/0/3
[SwitchB-vlan100] quit

# 在 VLAN100 内开启 DHCP Snooping 功能。
[SwitchB] dhcp snooping enable vlan 100

# 指定端口 GigabitEthernet1/0/1 为 VLAN 100 下 DHCP Snooping 功能的信任端口。
[SwitchB] vlan 100
[SwitchB-vlan100] dhcp snooping trust interface gigabitethernet 1/0/1

# 在 VLAN 100 内开启 DHCP Snooping 表项记录功能。
[SwitchB-vlan100] dhcp snooping binding record
[SwitchB-vlan100] quit

四、验证配置
配置完成后,DHCP 客户端只能从合法 DHCP 服务器获取 IP 地址和其它配置信息,非法 DHCP 服务器无法为 DHCP 客户端分配 IP 地址和其他配置信息。且使用 display dhcp snooping binding可查询到获取到的 DHCP Snooping 表项。

H3C网管交换机全局开启 DHCP Snooping 配置举例

一、 组网需求
•Switch B 通过以太网端口 GigabitEthernet1/0/1 连接到合法 DHCP 服务器,通过以太网端口GigabitEthernet1/0/3 连接到非法 DHCP 服务器,通过 GigabitEthernet1/0/2 连接到 DHCP 客户端。
要求:
• 与合法 DHCP 服务器相连的端口可以转发 DHCP 服务器的响应报文,而其他端口不转发DHCP 服务器的响应报文。
• 记录 DHCP-REQUEST 报文和信任端口收到的 DHCP-ACK 报文中 DHCP 客户端 IP 地址及MAC 地址的绑定信息。

二、组网图
DHCP Snooping 组网示意图

三、配置步骤
# 全局开启 DHCP Snooping 功能。
<SwitchB> system-view
[SwitchB] dhcp snooping enable

# 设置 GigabitEthernet1/0/1 端口为信任端口。
[SwitchB] interface gigabitethernet 1/0/1
[SwitchB-GigabitEthernet1/0/1] dhcp snooping trust
[SwitchB-GigabitEthernet1/0/1] quit

# 在 GigabitEthernet1/0/2 上开启 DHCP Snooping 表项功能。
[SwitchB] interface gigabitethernet 1/0/2
[SwitchB-GigabitEthernet1/0/2] dhcp snooping binding record
[SwitchB-GigabitEthernet1/0/2] quit

四、验证配置
配置完成后,DHCP 客户端只能从合法 DHCP 服务器获取 IP 地址和其它配置信息,非法 DHCP 服务器无法为 DHCP 客户端分配 IP 地址和其他配置信息。且使用 display dhcp snooping binding可查询到获取到的 DHCP Snooping 表项。

H3C网管交换机 PVST生成树典型配置举例

一、组网需求
• Device A 和 Device B 为汇聚层设备,Device C 和 Device D 为接入层设备。
• 通过配置 PVST,使 VLAN 10、20、30 和 40 中的报文分别按照其各自 VLAN 所对应的生成树转发。
• 由于 VLAN 10、20 和 30 在汇聚层设备终结、VLAN 40 在接入层设备终结,因此配置 VLAN10 和 20 的根桥为 Device A,VLAN 30 的根桥为 Device B,VLAN 40 的根桥为 Device C。

二、 组网图
PVST 典型配置组网图

三、配置步骤
(1) 配置 VLAN 和端口
请按照上图 在 Device A 和 Device B 上分别创建 VLAN 10、20 和 30,在 Device C 上创建 VLAN10、20 和 40,在 Device D 上创建 VLAN 20、30 和 40;将各设备的各端口配置为 Trunk 端口并允许相应的 VLAN 通过,具体配置过程略。

(2) 配置 Device A
# 配置生成树的工作模式为 PVST 模式。
<DeviceA> system-view
[DeviceA] stp mode pvst

# 配置本设备为 VLAN 10 和 VLAN 20 的根桥。
[DeviceA] stp vlan 10 20 root primary

# 全局开启生成树协议,并开启 VLAN 10、20 和 30 中的生成树协议。
[DeviceA] stp global enable
[DeviceA] stp vlan 10 20 30 enable

(3) 配置 Device B
# 配置生成树的工作模式为 PVST 模式。
<DeviceB> system-view
[DeviceB] stp mode pvst

# 配置本设备为 VLAN 30 的根桥。
[DeviceB] stp vlan 30 root primary

# 全局开启生成树协议,并开启 VLAN 10、20 和 30 中的生成树协议。
[DeviceB] stp global enable
[DeviceB] stp vlan 10 20 30 enable

(4) 配置 Device C
# 配置生成树的工作模式为 PVST 模式。
<DeviceC> system-view
[DeviceC] stp mode pvst

# 配置本设备为生成树 VLAN 40 的根桥。
[DeviceC] stp vlan 40 root primary

# 全局开启生成树协议,并开启 VLAN 10、20 和 40 中的生成树协议。
[DeviceC] stp global enable
[DeviceC] stp vlan 10 20 40 enable

(5) 配置 Device D
# 配置生成树的工作模式为 PVST 模式。
<DeviceD> system-view
[DeviceD] stp mode pvst

# 全局开启生成树协议,并开启 VLAN 20、30 和 40 中的生成树协议。
[DeviceD] stp global enable
[DeviceD] stp vlan 20 30 40 enable

四、 验证配置
当网络拓扑稳定后,通过使用 display stp brief 命令可以查看各设备上生成树的简要信息。例如:
# 查看 Device A 上生成树的简要信息。
[DeviceA] display stp brief
查看 Device A 上生成树的简要信息

# 查看 Device B 上生成树的简要信息。
[DeviceB] display stp brief
查看 Device B 上生成树的简要信息

# 查看 Device C 上生成树的简要信息。
[DeviceC] display stp brief
查看 Device C 上生成树的简要信息

# 查看 Device D 上生成树的简要信息。
[DeviceD] display stp brief
查看 Device D 上生成树的简要信息

根据上述显示信息,可以绘出各 VLAN 所对应 MSTI 的拓扑,如下图所示。
各 VLAN 所对应生成树的拓扑图

H3C网管交换机 MSTP 生成树典型配置举例

一、组网需求
• 网络中所有设备都属于同一个 MST 域。Device A 和 Device B 为汇聚层设备,Device C 和Device D 为接入层设备。
• 通过配置 MSTP,使不同 VLAN 的报文按照不同的 MSTI 转发:VLAN 10 的报文沿 MSTI 1转发,VLAN 30 沿 MSTI 3 转发,VLAN 40 沿 MSTI 4 转发,VLAN 20 沿 MSTI 0 转发。
• 由于 VLAN 10 和 VLAN 30 在汇聚层设备终结、VLAN 40 在接入层设备终结,因此配置 MSTI 1 和 MSTI 3 的根桥分别为 Device A 和 Device B,MSTI 4 的根桥为 Device C。

二、 组网图
MSTP 典型配置组网图

三、 配置准备
请在 VXLAN 网络内配置路由协议,确保 VTEP 之间路由可达。

四、配置步骤
(1) 配置 VLAN 和端口
请按照上图 在 Device A 和 Device B 上分别创建 VLAN 10、20 和 30,在 Device C 上创建 VLAN10、20 和 40,在 Device D 上创建 VLAN 20、30 和 40;将各设备的各端口配置为 Trunk 端口并允许相应的 VLAN 通过,具体配置过程略。

(2) 配置 Device A
# 配置 MST 域的域名为 example,将 VLAN 10、30、40 分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
<DeviceA> system-view
[DeviceA] stp region-configuration
[DeviceA-mst-region] region-name example
[DeviceA-mst-region] instance 1 vlan 10
[DeviceA-mst-region] instance 3 vlan 30
[DeviceA-mst-region] instance 4 vlan 40
[DeviceA-mst-region] revision-level 0

# 激活 MST 域的配置。
[DeviceA-mst-region] active region-configuration
[DeviceA-mst-region] quit

# 配置本设备为 MSTI 1 的根桥。
[DeviceA] stp instance 1 root primary

# 全局开启生成树协议。
[DeviceA] stp global enable

(3) 配置 Device B
# 配置 MST 域的域名为 example,将 VLAN 10、30、40 分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
<DeviceB> system-view
[DeviceB] stp region-configuration
[DeviceB-mst-region] region-name example
[DeviceB-mst-region] instance 1 vlan 10
[DeviceB-mst-region] instance 3 vlan 30
[DeviceB-mst-region] instance 4 vlan 40
[DeviceB-mst-region] revision-level 0

# 激活 MST 域的配置。
[DeviceB-mst-region] active region-configuration
[DeviceB-mst-region] quit

# 配置本设备为 MSTI 3 的根桥。
[DeviceB] stp instance 3 root primary

# 全局开启生成树协议。
[DeviceB] stp global enable

(4) 配置 Device C
# 配置 MST 域的域名为 example,将 VLAN 10、30、40 分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
<DeviceC> system-view
[DeviceC] stp region-configuration
[DeviceC-mst-region] region-name example
[DeviceC-mst-region] instance 1 vlan 10
[DeviceC-mst-region] instance 3 vlan 30
[DeviceC-mst-region] instance 4 vlan 40
[DeviceC-mst-region] revision-level 0

# 激活 MST 域的配置。
[DeviceC-mst-region] active region-configuration
[DeviceC-mst-region] quit

# 配置本设备为 MSTI 4 的根桥。
[DeviceC] stp instance 4 root primary

# 全局开启生成树协议。
[DeviceC] stp global enable

(5) 配置 Device D
# 配置 MST 域的域名为 example,将 VLAN 10、30、40 分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
<DeviceD> system-view
[DeviceD] stp region-configuration
[DeviceD-mst-region] region-name example
[DeviceD-mst-region] instance 1 vlan 10
[DeviceD-mst-region] instance 3 vlan 30
[DeviceD-mst-region] instance 4 vlan 40
[DeviceD-mst-region] revision-level 0

# 激活 MST 域的配置。
[DeviceD-mst-region] active region-configuration
[DeviceD-mst-region] quit

# 全局开启生成树协议。
[DeviceD] stp global enable

四、 验证配置
注:在本例中,假定 Device B 的根桥 ID 最小,因此该设备将在 MSTI 0 中被选举为根桥。当网络拓扑稳定后,通过使用 display stp brief 命令可以查看各设备上生成树的简要信息。例如:
# 查看 Device A 上生成树的简要信息。
[DeviceA] display stp brief
查看 Device A 上生成树的简要信息

# 查看 Device B 上生成树的简要信息。
[DeviceB] display stp brief
查看 Device B 上生成树的简要信息

# 查看 Device C 上生成树的简要信息。
[DeviceC] display stp brief
查看 Device C 上生成树的简要信息

# 查看 Device D 上生成树的简要信息。
[DeviceD] display stp brief
查看 Device D 上生成树的简要信息

根据上述显示信息,可以绘出各 VLAN 所对应 MSTI 的拓扑,如下图所示。
各 VLAN 所对应 MSTI 的拓扑图

H3C网管交换机VXLAN网络下的环路检测典型配置举例

一、组网需求
Device A、Device B 作为 VXLAN 网络的 VTEP,在其上配置环路检测功能,使系统能够自动禁止出现环路的 AC 进行 MAC 地址学习同时将其阻塞,并通过打印日志信息来通知用户检查网络。

二、 组网图
VXLAN 网络下的环路检测基本功能配置组网图

三、 配置准备
请在 VXLAN 网络内配置路由协议,确保 VTEP 之间路由可达。

四、配置步骤
配置 Device A
# 配置 VSI,VXLAN ID 和 Tunnel。
<DeviceA> system-view
[DeviceA] l2vpn enable
[DeviceA] interface tunnel 0 mode vxlan
[DeviceA-Tunnel0] source 1.1.1.1
[DeviceA-Tunnel0] destination 2.2.2.2
[DeviceA-Tunnel0] quit
[DeviceA] vsi 1
[DeviceA-vsi-1] vxlan 1
[DeviceA-vsi-1-vxlan-1] tunnel 0
[DeviceA-vsi-1-vxlan-1] quit
# 关闭 STP 功能。
[DeviceA] undo stp global enable
# 配置 AC。
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] service-instance 1
[DeviceA-Ten-GigabitEthernet1/0/1-srv1] encapsulation s-vid 10
[DeviceA-Ten-GigabitEthernet1/0/1-srv1] xconnect vsi 1
[DeviceA-Ten-GigabitEthernet1/0/1-srv1] quit
# 开启环路检测功能。
[DeviceA] vsi 1
[DeviceA-vsi-1] loopback-detection enable
# 配置环路检测的处理模式为 Block 模式。
[DeviceA-vsi-1] loopback-detection action block
# 配置环路检测的时间间隔为 35 秒。
[DeviceA-vsi-1] loopback-detection interval-time 35
# 配置环路检测的优先级为 1。
[DeviceA-vsi-1] loopback-detection priority 1
(2) 配置 Device B
# 配置 VSI,VXLAN ID 和 Tunnel。
<DeviceB> system-view
[DeviceB] l2vpn enable
[DeviceB] interface Tunnel 0 mode vxlan
[DeviceB-Tunnel0] source 2.2.2.2
[DeviceB-Tunnel0] destination 1.1.1.1
[DeviceB-Tunnel0] quit
[DeviceB] vsi 1
[DeviceB-vsi-1] vxlan 1
[DeviceB-vsi-1-vxlan-1] tunnel 0
[DeviceB-vsi-1-vxlan-1] quit
# 关闭 STP 功能。
[DeviceB] undo stp global enable
# 配置 AC。
[DeviceB] interface ten-gigabitethernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] service-instance 1
[DeviceB-Ten-GigabitEthernet1/0/1-srv1] encapsulation s-vid 10
[DeviceB-Ten-GigabitEthernet1/0/1-srv1] xconnect vsi 1
[DeviceB-Ten-GigabitEthernet1/0/1-srv1] quit
# 开启环路检测功能。
[DeviceB] vsi 1
[DeviceB-vsi-1] loopback-detection enable
# 配置环路检测的处理模式为 Block 模式。
[DeviceB-vsi-1] loopback-detection action block
# 配置环路检测的时间间隔为 35 秒。
[DeviceB-vsi-1] loopback-detection interval-time 35
# 配置 VSI 的环路检测优先级值为 6。
[DeviceB-vsi-1] loopback-detection priority 6

四、 验证配置
配置完成后,Device A 的 AC(Ten-GigabitEthernet1/0/1 接口上的以太网服务实例 1)在一个环路
检测时间间隔内检测到了环路,打印了如下日志信息:
打印了如下日志信息
# 显示 Device A 上环路检测的配置和运行情况
[DeviceA] display loopback-detection
显示 Device A 上环路检测的配置和运行情况

# 显示 Device B 上环路检测的配置和运行情况。
[DeviceB] display loopback-detection
显示 Device B 上环路检测的配置和运行情况

由此可见,Device A 和 Device B 都在各自的 AC(Ten-GigabitEthernet1/0/1 接口上的以太网服务实例 1)上检测到了环路,并且 Device B 阻塞存在环路的 AC。这是由于 Device A 的优先级较高,所以仅显示环路信息,未触发环路保护动作(环路检测处理模式字段的显示有特殊标识“*”)。

H3C网管交换机 M-LAG 应用环路检测配置举例

一、组网需求
在 M-LAG 组网环境中部署环路检测,以便在网络中存在环路时设备可以自动关闭设备上出现环路的端口,并及时通知用户检查网络环境。如下图 所示,Device A 和 Device B 组成 M-LAG 系统,同时部署环路检测。Device C、M-LAG 系统、Device D 和 Device E 组成一个物理上的环路。

二、 组网图
DRNI 应用环路检测配置组网图

三、配置步骤
(1) 配置 Device A# 创建 VLAN 100。
<DeviceA> system-view
[DeviceA] vlan 100
[DeviceA-vlan100] quit

# 配置 M-LAG 系统配置。
[DeviceA] m-lag system-mac 1-1-1
[DeviceA] m-lag system-number 1
[DeviceA] m-lag system-priority 123

# 配置 Keepalive 报文的目的 IP 地址和源 IP 地址。
[DeviceA] m-lag keepalive ip destination 1.1.1.1 source 1.1.1.2

# 配置端口 Ten-GigabitEthernet1/0/6 工作在三层模式,并配置 IP 地址为 Keepalive 报文的源 IP 地址。
[DeviceA] interface ten-gigabitethernet 1/0/6
[DeviceA-Ten-GigabitEthernet1/0/6] port link-mode route
[DeviceA-Ten-GigabitEthernet1/0/6] ip address 1.1.1.2 24
[DeviceA-Ten-GigabitEthernet1/0/6] quit

# 配置 Keepalive 链路接口为 M-LAG 保留接口。
[DeviceA] m-lag mad exclude interface ten-gigabitethernet 1/0/6

# 创建动态二层聚合接口 3,并配置该接口为 peer-link 口。
[DeviceA] interface bridge-aggregation 3
[DeviceA-Bridge-Aggregation3] link-aggregation mode dynamic
[DeviceA-Bridge-Aggregation3] port m-lag peer-link 1
[DeviceA-Bridge-Aggregation3] quit

# 将端口 Ten-GigabitEthernet1/0/5 加入到聚合组 3 中。
[DeviceA] interface ten-gigabitethernet 1/0/5
[DeviceA-Ten-GigabitEthernet1/0/5] port link-aggregation group 3
[DeviceA-Ten-GigabitEthernet1/0/5] quit

# 配置二层聚合接口 3 为 Trunk 端口,并允许 VLAN 100 的报文通过。
[DeviceA] interface bridge-aggregation 3
[DeviceA-Bridge-Aggregation3] port link-type trunk
[DeviceA-Bridge-Aggregation3] port trunk permit vlan 100
[DeviceA-Bridge-Aggregation3] quit

# 创建动态二层聚合接口 4,并配置该接口为 M-LAG 接口 4。
[DeviceA] interface bridge-aggregation 4
[DeviceA-Bridge-Aggregation4] link-aggregation mode dynamic
[DeviceA-Bridge-Aggregation4] port m-lag group 4
[DeviceA-Bridge-Aggregation4] quit

# 分别将端口 Ten-GigabitEthernet1/0/1 和 Ten-GigabitEthernet1/0/2 加入到聚合组 4 中。
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] port link-aggregation group 4
[DeviceA-Ten-GigabitEthernet1/0/1] quit
[DeviceA] interface ten-gigabitethernet 1/0/2
[DeviceA-Ten-GigabitEthernet1/0/2] port link-aggregation group 4
[DeviceA-Ten-GigabitEthernet1/0/2] quit

# 配置二层聚合接口 4 为 Trunk 端口,并允许 VLAN 100 的报文通过。
[DeviceA] interface bridge-aggregation 4
[DeviceA-Bridge-Aggregation4] port link-type trunk
[DeviceA-Bridge-Aggregation4] port trunk permit vlan 100
[DeviceA-Bridge-Aggregation4] quit

# 创建动态二层聚合接口 5,并配置该接口为 M-LAG 接口 5。
[DeviceA] interface bridge-aggregation 5
[DeviceA-Bridge-Aggregation5] link-aggregation mode dynamic
[DeviceA-Bridge-Aggregation5] port m-lag group 5
[DeviceA-Bridge-Aggregation5] quit

# 分别将端口 Ten-GigabitEthernet1/0/3 和 Ten-GigabitEthernet1/0/4 加入到聚合组 5 中。
[DeviceA] interface ten-gigabitethernet 1/0/3
[DeviceA-Ten-GigabitEthernet1/0/3] port link-aggregation group 5
[DeviceA-Ten-GigabitEthernet1/0/3] quit
[DeviceA] interface ten-gigabitethernet 1/0/4
[DeviceA-Ten-GigabitEthernet1/0/4] port link-aggregation group 5
[DeviceA-Ten-GigabitEthernet1/0/4] quit

# 配置二层聚合接口 5 为 Trunk 端口,并允许 VLAN 100 的报文通过。
[DeviceA] interface bridge-aggregation 5
[DeviceA-Bridge-Aggregation5] port link-type trunk
[DeviceA-Bridge-Aggregation5] port trunk permit vlan 100
[DeviceA-Bridge-Aggregation5] quit

# 关闭 STP 功能。
[DeviceA] undo stp global enable

# 全局开启 VLAN 100 内的环路检测功能,配置环路检测处理模式为 shutdown,环路检测的时间间隔为 35 秒。
[DeviceA] loopback-detection global enable vlan 100
[DeviceA] loopback-detection global action shutdown
[DeviceA] loopback-detection interval-time 35

(2) 配置 Device B
配置Device B的M-LAG系统编号为2,Keepalive报文的目的IP地址为1.1.1.2,源IP地址为1.1.1.1。其他配置与 Device A 类似,不再赘述。

(3) 配置 Device C
# 关闭 STP 功能。
<DeviceC> system-view
[DeviceC] undo stp global enable

# 创建 VLAN 100。
[DeviceC] vlan 100
[DeviceC-vlan100] quit

# 创建二层聚合接口 4,并配置该接口为动态聚合模式。
[DeviceC] interface bridge-aggregation 4
[DeviceC-Bridge-Aggregation4] link-aggregation mode dynamic
[DeviceC-Bridge-Aggregation4] quit

# 分别将端口 Ten-GigabitEthernet1/0/1~Ten-GigabitEthernet1/0/4 加入到聚合组 4 中。
[DeviceC] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/4
[DeviceC-if-range] port link-aggregation group 4
[DeviceC-if-range] quit

# 配置二层聚合接口 4 为 Trunk 端口,并允许 VLAN 100 的报文通过。
[DeviceC] interface bridge-aggregation 4
[DeviceC-Bridge-Aggregation4] port link-type trunk
[DeviceC-Bridge-Aggregation4] port trunk permit vlan 100
[DeviceC-Bridge-Aggregation4] quit

# 配置端口 Ten-GigabitEthernet1/0/5 为 Trunk 端口,并允许 VLAN 100 的报文通过。
[DeviceC] interface ten-gigabitethernet 1/0/5
[DeviceC-Ten-GigabitEthernet1/0/5] port link-type trunk
[DeviceC-Ten-GigabitEthernet1/0/5] port trunk permit vlan 100
[DeviceC-Ten-GigabitEthernet1/0/5] quit

(4) 配置 Device D
# 关闭 STP 功能。
<DeviceD> system-view
[DeviceD] undo stp global enable

# 创建 VLAN 100。
[DeviceD] vlan 100
[DeviceD-vlan100] quit

# 创建二层聚合接口 5,并配置该接口为动态聚合模式。
[DeviceD] interface bridge-aggregation 5
[DeviceD-Bridge-Aggregation5] link-aggregation mode dynamic
[DeviceD-Bridge-Aggregation5] quit

# 分别将端口 Ten-GigabitEthernet1/0/1~Ten-GigabitEthernet1/0/4 加入到聚合组 5 中。
[DeviceD] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/4
[DeviceD-if-range] port link-aggregation group 5
[DeviceD-if-range] quit

# 配置二层聚合接口 5 为 Trunk 端口,并允许 VLAN 100 的报文通过。
[DeviceD] interface bridge-aggregation 5
[DeviceD-Bridge-Aggregation5] port link-type trunk
[DeviceD-Bridge-Aggregation5] port trunk permit vlan 100
[DeviceD-Bridge-Aggregation5] quit

# 配置端口 Ten-GigabitEthernet1/0/5 为 Trunk 端口,并允许 VLAN 100 的报文通过。
[DeviceD] interface ten-gigabitethernet 1/0/5
[DeviceD-Ten-GigabitEthernet1/0/5] port link-type trunk
[DeviceD-Ten-GigabitEthernet1/0/5] port trunk permit vlan 100
[DeviceD-Ten-GigabitEthernet1/0/5] quit

(5) 配置 Device E
# 关闭 STP 功能。
<DeviceE> system-view
[DeviceE] undo stp global enable

# 创建 VLAN 100。
[DeviceE] vlan 100
[DeviceE-vlan100] quit

# 配置端口 Ten-GigabitEthernet1/0/1 和 Ten-GigabitEthernet1/0/2 为 Trunk 端口,并允许 VLAN 100的报文通过。
[DeviceE] interface ten-gigabitethernet 1/0/1
[DeviceE-Ten-GigabitEthernet1/0/1] port link-type trunk
[DeviceE-Ten-GigabitEthernet1/0/1] port trunk permit vlan 100
[DeviceE-Ten-GigabitEthernet1/0/1] quit
[DeviceE] interface ten-gigabitethernet 1/0/2
[DeviceE-Ten-GigabitEthernet1/0/2] port link-type trunk
[DeviceE-Ten-GigabitEthernet1/0/2] port trunk permit vlan 100
[DeviceE-Ten-GigabitEthernet1/0/2] quit

四、 验证配置
当配置完成后,系统在一个环路检测时间间隔内在 Device A 的 M-LAG 接口 4 和 M-LAG 接口 5 上都检测到了环路,于是将这两个 M-LAG 接口自动关闭,并打印了如下日志信息:
验证配置
使用 display loopback-detection 命令可以查看 Device A 上环路检测的配置和运行情况:

# 查看 Device A 上环路检测的配置和运行情况。
查看 Device A 上环路检测的配置和运行情况
由此可见,Device A 上显示在聚合组 4 和聚合组 5 上检测到环路,由于环路检测功能运行在Shutdown 模式下,聚合组 4 和聚合组 5 上出现环路后均已被自动关闭,因此设备打印的日志信息显示这两个聚合组上的环路已消除。此时,使用 display interface 命令分别查看 Device A 上聚合组 4 和聚合组 5 的状态信息:

# 显示 Device A 上聚合组 4 的状态信息。显示 Device A 上聚合组 4 的状态信息

# 显示 Device A 上聚合组 5 的状态信息
显示 Device A 上聚合组 5 的状态信息
由此可见,聚合组 4 和聚合组 5 均已被环路检测模块自动关闭。
Device B 上的现象和 Device A 上一致。

ICP备案号:晋ICP备18007549号-1
站长微信:15534641008