天天看點

環路檢測配置環路檢測配置

環路檢測配置

原理:裝置通過發送環路檢測封包并檢測其是否傳回本裝置(不要求收、發端口為同一端口)以确認是否存在環路,若某端口收到了由本裝置發出的環路檢測封包,就認定該端口所在鍊路存在環路。

特殊說明:一般關閉了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

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