天天看点

环路检测配置环路检测配置

环路检测配置

原理:设备通过发送环路检测报文并检测其是否返回本设备(不要求收、发端口为同一端口)以确认是否存在环路,若某端口收到了由本设备发出的环路检测报文,就认定该端口所在链路存在环路。

特殊说明:一般关闭了stp协议会存在环路,现在华为华三设备默认启用stp协议。

拓扑如图:

环路检测配置环路检测配置

三台交换机基础配置:

SWA配置:

[SWA]vlan 100

[SWA-vlan100]quit

[SWA]interface range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/2

[SWA-if-range]port link-type trunk

[SWA-if-range]port trunk permit vlan 100

[SWA-if-range]quit

SWA]undo stp global enable    #关闭stp

SWB配置:

[SWB]vlan 100

[SWB-vlan100]quit

[SWB]interface range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/2

[SWB-if-range]port link-type trunk

[SWB-if-range]port trunk permit vlan 100

[SWB-if-range]quit

[SWB]undo stp global enable

SWC配置:

[SWC]vlan 100

[SWC-vlan100]quit

[SWC]interface range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/2

[SWC-if-range]port link-type trunk

[SWC-if-range]port trunk permit vlan 100

[SWC-if-range]quit

[SWC]undo stp global enable

----------------------------------------------

#以上配置关闭了stp,已经存在环路。

全局配置环路检测:

[SWA]loopback-detection global enable vlan 100    #全局针对VLAN100内的环路检测功能

[SWA]loopback-detection global action shutdown   #全局配置环路检测的处理模式为Shutdown模式

[SWA]loopback-detection interval-time 20    #默认30S

   #配置环路检测的时间间隔为20秒,时间之后端口自动恢复UP,然后被检测环路又会被关闭

检测日志:

%Dec 12 21:32:16:550 2019 SWA LPDT/4/LPDT_LOOPED: Loopback exists on GigabitEthernet1/0/1.

%Dec 12 21:32:16:584 2019 SWA IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0/1 changed to down.

%Dec 12 21:32:16:587 2019 SWA IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/1 changed to down.

%Dec 12 21:32:16:609 2019 SWA LPDT/4/LPDT_VLAN_LOOPED: Loopback exists on GigabitEthernet1/0/1 in VLAN 100.

%Dec 12 21:32:16:611 2019 SWA LPDT/5/LPDT_VLAN_RECOVERED: Loopback on GigabitEthernet1/0/1 in VLAN 100 recovered.

%Dec 12 21:32:16:613 2019 SWA LPDT/5/LPDT_RECOVERED: Loopback on GigabitEthernet1/0/1 recovered.

%Dec 12 21:32:16:633 2019 SWA LPDT/4/LPDT_LOOPED: Loopback exists on GigabitEthernet1/0/2.

%Dec 12 21:32:16:698 2019 SWA IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0/2 changed to down.

%Dec 12 21:32:16:703 2019 SWA IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/2 changed to down.

%Dec 12 21:32:16:710 2019 SWA IFNET/3/PHY_UPDOWN: Physical state on the interface Vlan-interface100 changed to down.

%Dec 12 21:32:16:714 2019 SWA IFNET/5/LINK_UPDOWN: Line protocol state on the interface Vlan-interface100 changed to down.

%Dec 12 21:32:16:732 2019 SWA LPDT/4/LPDT_VLAN_LOOPED: Loopback exists on GigabitEthernet1/0/2 in VLAN 100.

%Dec 12 21:32:16:733 2019 SWA LPDT/5/LPDT_VLAN_RECOVERED: Loopback on GigabitEthernet1/0/2 in VLAN 100 recovered.

%Dec 12 21:32:16:733 2019 SWA LPDT/5/LPDT_RECOVERED: Loopback on GigabitEthernet1/0/2 recovered.

查看端口关闭由于有环路自动关闭:

[SWA]display interface GigabitEthernet 1/0/1

GigabitEthernet1/0/1

Current state: DOWN (Loopback detection down)

Line protocol state: DOWN

IP packet frame type: Ethernet II, hardware address: 4871-d643-0100

Description: GigabitEthernet1/0/1 Interface

Bandwidth: 1000000 kbps

Loopback is not set

Unknown-speed mode, unknown-duplex mode

Link speed type is autonegotiation, link duplex type is autonegotiation

Flow-control is not enabled

Maximum frame length: 9216

[SWA]display interface GigabitEthernet 1/0/2

GigabitEthernet1/0/2

Current state: DOWN(Loopback detection down)

Line protocol state: DOWN

IP packet frame type: Ethernet II, hardware address: 4871-d643-0100

Description: GigabitEthernet1/0/2 Interface

Bandwidth: 1000000 kbps

Loopback is not set

Unknown-speed mode, unknown-duplex mode

Link speed type is autonegotiation, link duplex type is autonegotiation

Flow-control is not enabled

Maximum frame length: 9216

----------------------------------------------------------------------------------------------

二层以太网接口配置环路检测:

[SWA]loopback-detection interval-time 20      #检测间隔30秒

[SWA]interface GigabitEthernet 1/0/1

[SWA-GigabitEthernet1/0/1]loopback-detection enable vlan 100

[SWA-GigabitEthernet1/0/1]loopback-detection action shutdown

[SWA-GigabitEthernet1/0/1]quit

[SWA]display loopback-detection

Loopback detection is enabled.

Loopback detection interval is 20 second(s).

Loopback is detected on following interfaces:

Interface Action mode

GigabitEthernet1/0/2 none

--------------------------------------------------------------------------------------