环路检测快速配置指南
目 录
1 环路检测快速配置指南
1.1 简介
本案例介绍环路检测的配置方法。
1.2 组网需求
如图1所示,
- 三台设备Device A、Device B和Device C组成一个物理上的环形网络。
- 通过在Device A上配置环路检测功能,使系统能够自动关闭Device A上出现环路的端口,并通过打印日志信息来通知用户检查网络。
图1 环路检测基本功能配置组网图
1.3 配置步骤
1. Device A的配置
# 创建VLAN 100,并全局开启该VLAN内的环路检测功能。
<DeviceA> system-view
[DeviceA] vlan 100
[DeviceA–vlan100] quit
[DeviceA] loopback-detection global enable vlan 100
# 配置端口GigabitEthernet1/0/1和GigabitEthernet1/0/2为Trunk类型,并允许VLAN 100通过。
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] port link-type trunk
[DeviceA-GigabitEthernet1/0/1] port trunk permit vlan 100
[DeviceA-GigabitEthernet1/0/1] quit
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] port link-type trunk
[DeviceA-GigabitEthernet1/0/2] port trunk permit vlan 100
[DeviceA-GigabitEthernet1/0/2] quit
# 全局配置环路检测的处理模式为Shutdown模式。
[DeviceA] loopback-detection global action shutdown
# 配置环路检测的时间间隔为35秒。
[DeviceA] loopback-detection interval-time 35
# 保存配置。
[DeviceA] save force
2. Device B的配置
# 创建VLAN 100。
<DeviceB> system-view
[DeviceB] vlan 100
[DeviceB–vlan100] quit
# 配置端口GigabitEthernet1/0/1和GigabitEthernet1/0/2为Trunk类型,并允许VLAN 100通过。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-GigabitEthernet1/0/1] port trunk permit vlan 100
[DeviceB-GigabitEthernet1/0/1] quit
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] port link-type trunk
[DeviceB-GigabitEthernet1/0/2] port trunk permit vlan 100
[DeviceB-GigabitEthernet1/0/2] quit
# 保存配置。
[DeviceB] save force
3. Device C的配置
# 创建VLAN 100。
<DeviceC> system-view
[DeviceC] vlan 100
[DeviceC–vlan100] quit
# 配置端口GigabitEthernet1/0/1和GigabitEthernet1/0/2为Trunk类型,并允许VLAN 100通过。
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] port link-type trunk
[DeviceC-GigabitEthernet1/0/1] port trunk permit vlan 100
[DeviceC-GigabitEthernet1/0/1] quit
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] port link-type trunk
[DeviceC-GigabitEthernet1/0/2] port trunk permit vlan 100
[DeviceC-GigabitEthernet1/0/2] quit
# 保存配置。
[DeviceC] save force
1.4 验证配置
当配置完成后,系统在一个环路检测时间间隔内在Device A的端口GigabitEthernet1/0/1和GigabitEthernet1/0/2上都检测到了环路,于是将这两个端口自动关闭,并打印了如下日志信息:
<DeviceA> %Aug 26 19:17:29:760 2021 DeviceA IFNET/3/PHY_UPDOWN: -MDC=1; Physical state on the interface GigabitEthernet1/0/2 changed to up.
%Aug 26 19:17:29:760 2021 DeviceA IFNET/5/LINK_UPDOWN: -MDC=1; Line protocol state on the interface GigabitEthernet1/0/2 changed to up.
%Aug 26 19:17:30:356 2021 DeviceA IFNET/3/PHY_UPDOWN: -MDC=1; Physical state on the interface GigabitEthernet1/0/1 changed to up.
%Aug 26 19:17:30:356 2021 DeviceA IFNET/5/LINK_UPDOWN: -MDC=1; Line protocol state on the interface GigabitEthernet1/0/1 changed to up.
%Aug 26 19:17:33:985 2021 DeviceA LPDT/4/LPDT_LOOPED: -MDC=1; A loop was detected on GigabitEthernet1/0/1.
%Aug 26 19:17:34:005 2021 DeviceA IFNET/3/PHY_UPDOWN: -MDC=1; Physical state on the interface GigabitEthernet1/0/1 changed to down.
%Aug 26 19:17:34:006 2021 DeviceA IFNET/5/LINK_UPDOWN: -MDC=1; Line protocol state on the interface GigabitEthernet1/0/1 changed to down.
%Aug 26 19:17:34:018 2021 DeviceA LPDT/4/LPDT_VLAN_LOOPED: -MDC=1; A loop was detected on GigabitEthernet1/0/1 in VLAN 100.
%Aug 26 19:17:34:019 2021 DeviceA LPDT/4/LPDT_LOOPED: -MDC=1; A loop was detected on GigabitEthernet1/0/2.
%Aug 26 19:17:34:040 2021 DeviceA IFNET/3/PHY_UPDOWN: -MDC=1; Physical state on the interface GigabitEthernet1/0/2 changed to down.
%Aug 26 19:17:34:041 2021 DeviceA IFNET/5/LINK_UPDOWN: -MDC=1; Line protocol state on the interface GigabitEthernet1/0/2 changed to down.
%Aug 26 19:17:34:055 2021 DeviceA LPDT/4/LPDT_VLAN_LOOPED: -MDC=1; A loop was detected on GigabitEthernet1/0/2 in VLAN 100.
%Aug 26 19:17:34:055 2021 DeviceA LPDT/5/LPDT_VLAN_RECOVERED: -MDC=1; A loop was removed on GigabitEthernet1/0/1 in VLAN 100.
%Aug 26 19:17:34:055 2021 DeviceA LPDT/5/LPDT_RECOVERED: -MDC=1; All loops were removed on GigabitEthernet1/0/1.
%Aug 26 19:17:34:056 2021 DeviceA LPDT/5/LPDT_VLAN_RECOVERED: -MDC=1; A loop was removed on GigabitEthernet1/0/2 in VLAN 100.
%Aug 26 19:17:34:056 2021 DeviceA LPDT/5/LPDT_RECOVERED: -MDC=1; All loops were removed on GigabitEthernet1/0/2.
使用display loopback-detection命令可以查看Device A上环路检测的配置和运行情况:
# 显示Device A上环路检测的配置和运行情况。
<DeviceA> display loopback-detection
Loop detection is enabled.
Global loop detection interval is 35 second(s).
Loop is detected on following interfaces:
Interface Action mode VLANs/VSI
GigabitEthernet1/0/1 Shutdown 100
GigabitEthernet1/0/2 Shutdown 100
由此可见,Device A上显示在端口GigabitEthernet1/0/1和GigabitEthernet1/0/2上检测到环路,由于环路检测功能运行在Shutdown模式下,端口GigabitEthernet1/0/1和GigabitEthernet1/0/2上出现环路后均已被自动关闭,因此设备打印的日志信息显示这两个端口上的环路已消除。此时,使用display interface命令分别查看Device A上端口GigabitEthernet1/0/1和GigabitEthernet1/0/2的状态信息:
<DeviceA> display interface gigabitEthernet 1/0/1
GigabitEthernet1/0/1
Current state: DOWN (Loopback detection down)
<DeviceA>display interface gigabitEthernet 1/0/2
GigabitEthernet1/0/2
Current state: DOWN (Loopback detection down)
由此可见,端口GigabitEthernet1/0/1和GigabitEthernet1/0/2均已被环路检测模块自动关闭。
1.5 配置文件
- Device A:
#
loopback-detection global enable vlan 100
loopback-detection global action shutdown
loopback-detection interval-time 35
#
vlan 100
#
interface GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100
#
interface GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100
#
- Device B :
#
vlan 100
#
interface GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100
#
interface GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100
#
- Device C :
#
vlan 100
#
interface GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100
#
interface GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100
#
1.6 相关资料
- 产品配套“二层技术-以太网交换配置指导”中的“环路检测”。
- 产品配套“二层技术-以太网交换命令参考”中的“环路检测”。