• 產品與解決方案
  • 行業解決方案
  • 服務
  • 支持
  • 合作夥伴
  • 關於我們

04-二層技術-以太網交換配置指導

目錄

09-環路檢測配置

本章節下載 09-環路檢測配置  (397.59 KB)

09-環路檢測配置


1 環路檢測

1.1  環路檢測簡介

1.1.1  環路檢測產生背景

環路檢測能夠及時發現二層網絡中的環路,通過周期性的檢查,使網絡中出現環路時能及時通知用戶檢查網絡連接和配置情況。當網絡中出現環路時,環路檢測機製通過生成日誌信息(請參見“網絡管理和監控配置指導”中的“信息中心”)來通知用戶,並可根據用戶事先的配置來選擇是否關閉出現環路的端口。

1.1.2  環路檢測報文

設備通過發送環路檢測報文並檢測其是否返回本設備(不要求收、發端口為同一端口)以確認是否存在環路。若某端口收到了由本設備發出的環路檢測報文,就認定該端口所在鏈路存在環路。

提示

環路檢測通常工作在特定的VLAN內,但也可能因QinQ或VLAN映射等特性的配置錯誤而導致VLAN間的環路(即盡管發出和收到的報文所攜帶的VLAN信息不同,但仍認為存在環路)。有關QinQ和VLAN映射的詳細介紹,請分別參見“二層技術-以太網交換配置指導”中的“QinQ”和“VLAN映射”。

圖1-1 環路檢測報文以太網頭的封裝格式

 

環路檢測報文以太網頭的封裝格式如圖1-1所示,其中各字段的解釋如下:

·     DMAC:報文的目的MAC地址,使用組播MAC地址010f-e200-0007。當設備開啟了環路檢測功能時,會將該目的地址的報文上送CPU處理,並在收到該報文的VLAN內將原始報文廣播一份。

·     SMAC:報文的源MAC地址,為發送該報文的設備的橋MAC地址。

·     TPID:VLAN標簽的類型,取值為0x8100。

·     TCI:VLAN標簽的具體值,具體內容為優先級、VLAN ID等。

·     Type:協議類型,取值為0x8918。

圖1-2 環路檢測報文內部頭的封裝格式

 

環路檢測報文的內部頭的封裝格式如圖1-2所示,其中各字段的解釋如下:

·     Code:協議子類型,取值為0x0001,表示環路檢測協議。

·     Version:版本,取值為0x0000,目前保留。

·     Length:報文長度(包括環路檢測報文的頭部,但不包括以太網頭部)。

·     Reserved:保留字段。

環路檢測報文的內容以TLV(Type/Length/Value,類型/長度/值)格式進行封裝,環路檢測支持的TLV類型如表1-1所示。

表1-1 環路檢測支持的TLV類型

TLV名稱

說明

攜帶要求

End of PDU

結束TLV,用來標誌PDU結束

可選

Device ID

設備標識TLV,表示發送設備的橋MAC地址

必須

Port ID

端口標識TLV,用來標識PDU發送端的端口索引

可選

Port Name

端口名稱TLV,用來標識PDU發送端的端口名稱

可選

System Name

係統名稱TLV,表示設備的名稱

可選

Chassis ID

框號TLV,表示發送端口所在的框號

可選

Slot ID

槽位號TLV,表示發送端口所在的槽位號

可選

Sub Slot ID

子槽位號TLV,表示發送端口所在的子槽位號

可選

 

1.1.3  環路檢測時間間隔

由於網絡時刻處於變化中,因此環路檢測是一個持續的過程,它以一定的時間間隔發送環路檢測報文來確定各端口是否出現環路、以及存在環路的端口上是否已消除環路等,這個時間間隔就稱為環路檢測的時間間隔。

1.1.4  環路檢測處理模式

環路檢測的處理模式是指當係統檢測到端口出現環路時的處理方式,包括以下幾種:

·     Block模式:當係統檢測到端口出現環路時,除了生成日誌信息外,還會禁止端口學習MAC地址並將端口阻塞。

·     No-learning模式:當係統檢測到端口出現環路時,除了生成日誌信息外,還會禁止端口學習MAC地址。

·     Shutdown模式:當係統檢測到端口出現環路時,除了生成日誌信息外,還會自動關閉該端口,使其不能收發任何報文。

·     VLAN-block模式:可以在設備上指定VLAN為環路檢測保護VLAN。設備通過在保護VLAN內發送環路檢測報文並檢測其是否返回本設備(不要求收、發端口為同一端口)來確認是否存在環路。當係統檢測到保護VLAN出現環路時,除了生成日誌信息外,還會將該VLAN阻塞。

缺省情況下,係統不采用上述任何一種模式,當係統檢測到端口出現環路時,除了生成日誌信息外不對該端口進行任何處理。

1.1.5  環路檢測處理的延遲時間

在開啟環路檢測功能的網絡中,設備檢測到環路後,可以延遲對檢測到環路的端口根據配置的環路檢測處理模式進行阻塞或關閉處理。從端口收到本設備發出的環路檢測報文到設備對此端口進行處理這段時間,就稱為環路檢測處理的延遲時間。用戶可以通過在上遊設備開啟環路檢測處理的延時功能並配置延時時間,使下遊設備先對環路檢測進行處理,以避免因上遊設備端口被阻塞或關閉,影響下遊所有設備的流量。

1.1.6  端口狀態自動恢複

在Block模式和No-learning模式下,當設備檢測到某端口出現環路後,若在三倍的環路檢測時間間隔內仍未收到環路檢測報文,就認為該端口上的環路已消除,自動將該端口恢複為正常轉發狀態,並生成日誌通知給用戶。這個過程就是端口狀態的自動恢複過程。

在Shutdown模式下,出現環路的端口先被自動關閉,然後在shutdown-interval命令(請參考“基礎配置命令參考”中的“設備管理”)所配置的時間之後自動恢複。如果此時環路尚未消除,該端口將被再次關閉,然後恢複……如此往複直至環路消除。

在VLAN-block模式下,當設備檢測到保護VLAN內出現環路後,若在三倍的環路檢測時間間隔內仍未收到環路檢測報文,就認為該VLAN上的環路已消除,將VLAN內端口恢複為正常轉發狀態,並生成日誌通知給用戶。

提示

當網絡中存在環路時,為防止大量報文的衝擊,設備會丟棄部分報文。而如果環路檢測報文也被丟棄,設備在端口狀態自動恢複功能的作用下會誤判定環路已消除。在這種情況下,建議將環路檢測的處理模式配置為Shutdown模式,或當設備提示出現環路時通過手工排查來消除環路。

 

1.2  環路檢測配置限製和指導

在M-LAG組網環境中,M-LAG設備上的環路檢測相關配置要保證一致。

1.3  環路檢測配置任務簡介

環路檢測配置任務如下:

(1)     開啟環路檢測功能

¡     全局開啟環路檢測功能

¡     在端口上開啟環路檢測功能

(2)     配置環路檢測保護VLAN

采用VLAN-block環路檢測處理模式時,必須執行本配置;采用其他環路檢測處理模式時,無需執行本配置

(3)     (可選)配置環路檢測處理模式

¡     全局配置環路檢測處理模式

¡     在接口上配置環路檢測處理模式

(4)     (可選)配置環路檢測時間間隔

(5)     (可選)配置環路檢測處理的延遲時間

¡     全局配置環路檢測處理的延遲時間

¡     在接口上配置環路檢測處理的延遲時間

1.4  開啟環路檢測功能

1.4.1  配置限製和指導

設備全局或者端口開啟環路檢測功能,當設備上任一端口收到設備發送的任一VLAN的環路檢測報文時,會觸發該端口的環路保護動作。

全局開啟環路檢測功能後,如果同時配置端口上的環路檢測功能,建議不要在端口上配置環路檢測的處理模式為Block。

1.4.2  全局開啟環路檢測功能

(1)     進入係統視圖。

system-view

(2)     全局開啟環路檢測功能。

loopback-detection global enable vlan { vlan-id-list | all }

缺省情況下,環路檢測功能處於全局關閉狀態。

1.4.3  在端口上開啟環路檢測功能

(1)     進入係統視圖。

system-view

(2)     進入二層以太網接口/二層聚合接口視圖。

interface interface-type interface-number

(3)     在端口上開啟環路檢測功能。

loopback-detection enable vlan { vlan-id-list | all }

缺省情況下,端口上的環路檢測功能處於關閉狀態。

1.5  配置環路檢測保護VLAN

(1)     進入係統視圖。

system-view

(2)     配置環路檢測保護VLAN。

loopback-detection protected-vlan vlan-id-list

缺省情況下,未配置環路檢測的保護VLAN。

1.6  配置環路檢測處理模式

1.6.1  配置限製和指導

用戶可以在係統視圖下全局配置環路檢測的處理模式,也可以在接口視圖下配置當前端口的環路檢測處理模式。係統視圖下的配置對所有端口都有效,接口視圖下的配置則隻對當前端口有效,且接口視圖下的配置優先級較高。

1.6.2  全局配置環路檢測處理模式

(1)     進入係統視圖。

system-view

(2)     全局配置環路檢測的處理模式。

loopback-detection global action shutdown

缺省情況下,當係統檢測到端口出現環路時不對該端口進行任何處理,僅生成日誌信息。

1.6.3  在接口上配置環路檢測處理模式

(1)     進入係統視圖。

system-view

(2)     進入接口視圖。

interface interface-type interface-number

(3)     在端口上配置環路檢測的處理模式。

loopback-detection action { block | no-learning | shutdown | vlan-block }

缺省情況下,當係統檢測到端口出現環路時不對該端口進行任何處理,僅生成日誌信息。

要使配置的VLAN-block處理模式生效,必須先配置環路檢測保護VLAN並開啟基於該VLAN的環路檢測功能。

不同接口下支持配置處理模式不同,具體支持情況請參見命令手冊。

1.7  配置環路檢測時間間隔

1. 功能簡介

當開啟了環路檢測功能後,係統開始以一定的時間間隔發送環路檢測報文,該間隔越長耗費的係統性能越少,該間隔越短環路檢測的靈敏度越高。用戶可以通過本配置調整發送環路檢測報文的時間間隔,以在係統性能和環路檢測的靈敏度之間進行平衡。

2. 配置步驟

(1)     進入係統視圖。

system-view

(2)     配置環路檢測的時間間隔。

loopback-detection interval-time interval

缺省情況下,環路檢測的時間間隔為30秒。

1.8  配置環路檢測處理的延遲時間

1.8.1  配置限製和指導

係統視圖下的配置對所有二層以太網接口都有效,接口視圖下的配置則隻對當前接口有效,且接口視圖下的配置優先級較高。

建議不同端口或不同設備上配置不同環路檢測延遲時間,避免網絡中的設備端口同時down或up。

1.8.2  全局配置環路檢測處理的延遲時間

(1)     進入係統視圖。

system-view

(2)     開啟環路檢測處理的延遲功能並配置延遲時間。

loopback-detection global delay-timer time

缺省情況下,環路檢測處理的延遲功能處於關閉狀態,設備檢測到環路之後立即進行處理。

1.8.3  在接口上配置環路檢測處理的延遲時間

(1)     進入係統視圖。

system-view

(2)     進入接口視圖。

interface interface-type interface-number

(3)     在端口上配置環路檢測的延遲時間。

loopback-detection delay-timer time

缺省情況下,端口上的環路檢測延遲功能處於關閉狀態,環路檢測處理的延遲時間以全局配置為準。

1.9  環路檢測顯示和維護

在完成上述配置後,在任意視圖下執行display命令可以顯示配置後環路檢測的運行情況,通過查看顯示信息驗證配置的效果。

表1-2 環路檢測顯示和維護

操作

命令

顯示環路檢測的配置和運行情況

display loopback-detection [ loop-info ]

 

1.10  環路檢測典型配置舉例

1.10.1  環路檢測基本功能配置舉例

1. 組網需求

·     三台設備Device A、Device B和Device C組成一個物理上的環形網絡。

·     通過在Device A上配置環路檢測功能,使係統能夠自動關閉Device A上出現環路的端口,並通過打印日誌信息來通知用戶檢查網絡。

2. 組網圖

圖1-3 環路檢測基本功能配置組網圖

 

3. 配置步驟

(1)     配置Device A

# 創建VLAN 100,並全局開啟該VLAN內的環路檢測功能。

<DeviceA> system-view

[DeviceA] vlan 100

[DeviceA–vlan100] quit

[DeviceA] loopback-detection global enable vlan 100

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2為Trunk類型,並允許VLAN 100通過。

[DeviceA] interface ten-gigabitethernet 3/0/1

[DeviceA-Ten-GigabitEthernet3/0/1] port link-type trunk

[DeviceA-Ten-GigabitEthernet3/0/1] port trunk permit vlan 100

[DeviceA-Ten-GigabitEthernet3/0/1] quit

[DeviceA] interface ten-gigabitethernet 3/0/2

[DeviceA-Ten-GigabitEthernet3/0/2] port link-type trunk

[DeviceA-Ten-GigabitEthernet3/0/2] port trunk permit vlan 100

[DeviceA-Ten-GigabitEthernet3/0/2] quit

# 全局配置環路檢測的處理模式為Shutdown模式。

[DeviceA] loopback-detection global action shutdown

# 配置環路檢測的時間間隔為35秒。

[DeviceA] loopback-detection interval-time 35

(2)     配置Device B

# 創建VLAN 100。

<DeviceB> system-view

[DeviceB] vlan 100

[DeviceB–vlan100] quit

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2為Trunk類型,並允許VLAN 100通過。

[DeviceB] interface ten-gigabitethernet 3/0/1

[DeviceB-Ten-GigabitEthernet3/0/1] port link-type trunk

[DeviceB-Ten-GigabitEthernet3/0/1] port trunk permit vlan 100

[DeviceB-Ten-GigabitEthernet3/0/1] quit

[DeviceB] interface ten-gigabitethernet 3/0/2

[DeviceB-Ten-GigabitEthernet3/0/2] port link-type trunk

[DeviceB-Ten-GigabitEthernet3/0/2] port trunk permit vlan 100

[DeviceB-Ten-GigabitEthernet3/0/2] quit

(3)     配置Device C

# 創建VLAN 100。

<DeviceC> system-view

[DeviceC] vlan 100

[DeviceC–vlan100] quit

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2為Trunk類型,並允許VLAN 100通過。

[DeviceC] interface ten-gigabitethernet 3/0/1

[DeviceC-Ten-GigabitEthernet3/0/1] port link-type trunk

[DeviceC-Ten-GigabitEthernet3/0/1] port trunk permit vlan 100

[DeviceC-Ten-GigabitEthernet3/0/1] quit

[DeviceC] interface ten-gigabitethernet 3/0/2

[DeviceC-Ten-GigabitEthernet3/0/2] port link-type trunk

[DeviceC-Ten-GigabitEthernet3/0/2] port trunk permit vlan 100

[DeviceC-Ten-GigabitEthernet3/0/2] quit

4. 驗證配置

當配置完成後,係統在一個環路檢測時間間隔內在Device A的端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2上都檢測到了環路,於是將這兩個端口自動關閉,並打印了如下日誌信息:

[DeviceA]

%Feb 24 15:04:29:663 2019 DeviceA LPDT/4/LPDT_LOOPED:  A loop was detected on Ten-GigabitEthernet3/0/1.

%Feb 24 15:04:29:664 2019 DeviceA LPDT/4/LPDT_VLAN_LOOPED: A loop was detected on Ten-GigabitEthernet3/0/1 in VLAN 100.

%Feb 24 15:04:29:667 2019 DeviceA LPDT/4/LPDT_LOOPED: A loop was detected on Ten-GigabitEthernet3/0/2.

%Feb 24 15:04:29:668 2019 DeviceA LPDT/4/LPDT_VLAN_LOOPED: A loop was detected on Ten-GigabitEthernet3/0/2 in VLAN 100.

%Feb 24 15:04:44:243 2019 DeviceA LPDT/5/LPDT_VLAN_RECOVERED: A loop was removed on Ten-GigabitEthernet3/0/1 in VLAN 100.

%Feb 24 15:04:44:243 2019 DeviceA LPDT/5/LPDT_RECOVERED: All loops were removed on Ten-GigabitEthernet3/0/1.

%Feb 24 15:04:44:248 2019 DeviceA LPDT/5/LPDT_VLAN_RECOVERED: A loop was removed on Ten-GigabitEthernet3/0/2 in VLAN 100.

%Feb 24 15:04:44:248 2019 DeviceA LPDT/5/LPDT_RECOVERED: All loops were removed on Ten-GigabitEthernet3/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

 Ten-GigabitEthernet3/0/1       Shutdown        100

 Ten-GigabitEthernet3/0/2       Shutdown        100

由此可見,Device A上顯示在端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2上檢測到環路,由於環路檢測功能運行在Shutdown模式下,端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2上出現環路後均已被自動關閉,因此設備打印的日誌信息顯示這兩個端口上的環路已消除。此時,使用display interface命令分別查看Device A上端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2的狀態信息:

# 顯示Device A上端口Ten-GigabitEthernet3/0/1的狀態信息。

[DeviceA] display interface ten-gigabitethernet 3/0/1

Ten-GigabitEthernet3/0/1 current state: DOWN (Loopback detection down)

...

# 顯示Device A上端口Ten-GigabitEthernet3/0/2的狀態信息。

[DeviceA] display interface ten-gigabitethernet 3/0/2

Ten-GigabitEthernet3/0/2 current state: DOWN (Loopback detection down)

...

由此可見,端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2均已被環路檢測模塊自動關閉。

1.10.2  環路檢測VLAN-block處理模式配置舉例

1. 組網需求

·     三台設備Device A、Device B和Device C組成一個物理上的環形網絡。

·     通過在Device A上開啟環路檢測功能,並采用VLAN-block模式,使係統能夠自動阻塞Device A上出現環路的VLAN,並通過打印日誌信息來通知用戶檢查網絡。

2. 組網圖

圖1-4 環路檢測VLAN-block處理模式配置組網圖

3. 配置步驟

(1)     配置Device A

# 創建VLAN 100,指定VLAN 100為保護VLAN,並全局開啟該VLAN內的環路檢測功能。

<DeviceA> system-view

[DeviceA] vlan 100

[DeviceA–vlan100] quit

[DeviceA] loopback-detection protected-vlan 100

[DeviceA] loopback-detection global enable vlan 100

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2為Trunk類型,並允許VLAN 100通過。

[DeviceA] interface ten-gigabitethernet 3/0/1

[DeviceA-Ten-GigabitEthernet3/0/1] port link-type trunk

[DeviceA-Ten-GigabitEthernet3/0/1] port trunk permit vlan 100

[DeviceA-Ten-GigabitEthernet3/0/1] quit

[DeviceA] interface ten-gigabitethernet 3/0/2

[DeviceA-Ten-GigabitEthernet3/0/2] port link-type trunk

[DeviceA-Ten-GigabitEthernet3/0/2] port trunk permit vlan 100

[DeviceA-Ten-GigabitEthernet3/0/2] quit

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2的環路檢測處理模式為VLAN-block模式。

[DeviceA] interface ten-gigabitethernet 3/0/1

[DeviceA-Ten-GigabitEthernet3/0/1] undo stp enable

[DeviceA-Ten-GigabitEthernet3/0/1] loopback-detection action vlan-block

[DeviceA-Ten-GigabitEthernet3/0/1] quit

[DeviceA] interface ten-gigabitethernet 3/0/2

[DeviceA-Ten-GigabitEthernet3/0/2] undo stp enable

[DeviceA-Ten-GigabitEthernet3/0/2] loopback-detection action vlan-block

[DeviceA-Ten-GigabitEthernet3/0/2] quit

# 配置環路檢測的時間間隔為35秒。

[DeviceA] loopback-detection interval-time 35

(2)     配置Device B

# 創建VLAN 100。

<DeviceB> system-view

[DeviceB] vlan 100

[DeviceB–vlan100] quit

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2為Trunk類型,並允許VLAN 100通過。

[DeviceB] interface ten-gigabitethernet 3/0/1

[DeviceB-Ten-GigabitEthernet3/0/1] port link-type trunk

[DeviceB-Ten-GigabitEthernet3/0/1] port trunk permit vlan 100

[DeviceB-Ten-GigabitEthernet3/0/1] quit

[DeviceB] interface ten-gigabitethernet 3/0/2

[DeviceB-Ten-GigabitEthernet3/0/2] port link-type trunk

[DeviceB-Ten-GigabitEthernet3/0/2] port trunk permit vlan 100

[DeviceB-Ten-GigabitEthernet3/0/2] quit

(3)     配置Device C

# 創建VLAN 100。

<DeviceC> system-view

[DeviceC] vlan 100

[DeviceC–vlan100] quit

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2為Trunk類型,並允許VLAN 100通過。

[DeviceC] interface ten-gigabitethernet 3/0/1

[DeviceC-Ten-GigabitEthernet3/0/1] port link-type trunk

[DeviceC-Ten-GigabitEthernet3/0/1] port trunk permit vlan 100

[DeviceC-Ten-GigabitEthernet3/0/1] quit

[DeviceC] interface ten-gigabitethernet 3/0/2

[DeviceC-Ten-GigabitEthernet3/0/2] port link-type trunk

[DeviceC-Ten-GigabitEthernet3/0/2] port trunk permit vlan 100

[DeviceC-Ten-GigabitEthernet3/0/2] quit

4. 驗證配置

當配置完成後,係統在一個環路檢測時間間隔內在Device A的端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2上都檢測到了環路,並打印了如下日誌信息。

[DeviceA]

%Feb 24 15:04:29:663 2019 DeviceA LPDT/4/LPDT_LOOPED:  A loop was detected on Ten-GigabitEthernet3/0/1.

%Feb 24 15:04:29:664 2019 DeviceA LPDT/4/LPDT_VLAN_LOOPED: A loop was detected on Ten-GigabitEthernet3/0/1 in VLAN 100.

%Feb 24 15:04:29:667 2019 DeviceA LPDT/4/LPDT_LOOPED: A loop was detected on Ten-GigabitEthernet3/0/2.

%Feb 24 15:04:29:668 2019 DeviceA LPDT/4/LPDT_VLAN_LOOPED: A loop was detected on Ten-GigabitEthernet3/0/2 in VLAN 100.

# 顯示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

  Ten-GigabitEthernet1/0/1       VLAN-block 100

  Ten-GigabitEthernet1/0/2       VLAN-block 100

由此可見,Device A在端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2上檢測到環路。由於環路檢測功能運行在VLAN-block模式下,端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2上出現環路後VLAN 100均已被阻塞,因此設備打印的日誌信息顯示這兩個端口上的環路已消除。

1.10.3  M-LAG應用環路檢測配置舉例

1. 組網需求

在M-LAG組網環境中部署環路檢測,以便在網絡中存在環路時設備可以自動關閉設備上出現環路的端口,並及時通知用戶檢查網絡環境。如圖1-5所示,Device A和Device B組成M-LAG係統,同時部署環路檢測。Device C、M-LAG係統、Device D和Device E組成一個物理上的環路。

2. 組網圖

圖1-5 M-LAG應用環路檢測配置組網圖

 

3. 配置步驟

(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-GigabitEthernet3/0/6工作在三層模式,並配置IP地址為Keepalive報文的源IP地址。

[DeviceA] interface ten-gigabitethernet 3/0/6

[DeviceA-Ten-GigabitEthernet3/0/6] port link-mode route

[DeviceA-Ten-GigabitEthernet3/0/6] ip address 1.1.1.2 24

[DeviceA-Ten-GigabitEthernet3/0/6] quit

# 配置Keepalive鏈路接口為M-LAG保留接口。

[DeviceA] m-lag mad exclude interface ten-gigabitethernet 3/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-GigabitEthernet3/0/5加入到聚合組3中。

[DeviceA] interface ten-gigabitethernet 3/0/5

[DeviceA-Ten-GigabitEthernet3/0/5] port link-aggregation group 3

[DeviceA-Ten-GigabitEthernet3/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-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2加入到聚合組4中。

[DeviceA] interface ten-gigabitethernet 3/0/1

[DeviceA-Ten-GigabitEthernet3/0/1] port link-aggregation group 4

[DeviceA-Ten-GigabitEthernet3/0/1] quit

[DeviceA] interface ten-gigabitethernet 3/0/2

[DeviceA-Ten-GigabitEthernet3/0/2] port link-aggregation group 4

[DeviceA-Ten-GigabitEthernet3/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-GigabitEthernet3/0/3和Ten-GigabitEthernet3/0/4加入到聚合組5中。

[DeviceA] interface ten-gigabitethernet 3/0/3

[DeviceA-Ten-GigabitEthernet3/0/3] port link-aggregation group 5

[DeviceA-Ten-GigabitEthernet3/0/3] quit

[DeviceA] interface ten-gigabitethernet 3/0/4

[DeviceA-Ten-GigabitEthernet3/0/4] port link-aggregation group 5

[DeviceA-Ten-GigabitEthernet3/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-GigabitEthernet3/0/1~Ten-GigabitEthernet3/0/4加入到聚合組4中。

[DeviceC] interface range ten-gigabitethernet 3/0/1 to ten-gigabitethernet 3/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-GigabitEthernet3/0/5為Trunk端口,並允許VLAN 100的報文通過。

[DeviceC] interface ten-gigabitethernet 3/0/5

[DeviceC-Ten-GigabitEthernet3/0/5] port link-type trunk

[DeviceC-Ten-GigabitEthernet3/0/5] port trunk permit vlan 100

[DeviceC-Ten-GigabitEthernet3/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-GigabitEthernet3/0/1~Ten-GigabitEthernet3/0/4加入到聚合組5中。

[DeviceD] interface range ten-gigabitethernet 3/0/1 to ten-gigabitethernet 3/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-GigabitEthernet3/0/5為Trunk端口,並允許VLAN 100的報文通過。

[DeviceD] interface ten-gigabitethernet 3/0/5

[DeviceD-Ten-GigabitEthernet3/0/5] port link-type trunk

[DeviceD-Ten-GigabitEthernet3/0/5] port trunk permit vlan 100

[DeviceD-Ten-GigabitEthernet3/0/5] quit

(5)     配置Device E

# 關閉STP功能。

<DeviceE> system-view

[DeviceE] undo stp global enable

# 創建VLAN 100。

[DeviceE] vlan 100

[DeviceE-vlan100] quit

# 配置端口Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2為Trunk端口,並允許VLAN 100的報文通過。

[DeviceE] interface ten-gigabitethernet 3/0/1

[DeviceE-Ten-GigabitEthernet3/0/1] port link-type trunk

[DeviceE-Ten-GigabitEthernet3/0/1] port trunk permit vlan 100

[DeviceE-Ten-GigabitEthernet3/0/1] quit

[DeviceE] interface ten-gigabitethernet 3/0/2

[DeviceE-Ten-GigabitEthernet3/0/2] port link-type trunk

[DeviceE-Ten-GigabitEthernet3/0/2] port trunk permit vlan 100

[DeviceE-Ten-GigabitEthernet3/0/2] quit

4. 驗證配置

當配置完成後,係統在一個環路檢測時間間隔內在Device A的M-LAG接口4和M-LAG接口5上都檢測到了環路,於是將這兩個M-LAG接口自動關閉,並打印了如下日誌信息:

[DeviceA]

%Aug  1 03:28:48:110 2019 DeviceA LPDT/4/LPDT_LOOPED: A loop was detected on

 Bridge-Aggregation4.

%Aug  1 03:28:48:191 2019 DeviceA LPDT/4/LPDT_VLAN_LOOPED: A loop was detect

ed on Bridge-Aggregation4 in VLAN 100.

%Aug  1 03:28:48:194 2019 DeviceA LPDT/4/LPDT_LOOPED: A loop was detected on

 Bridge-Aggregation5.

%Aug  1 03:28:48:288 2019 DeviceA LPDT/4/LPDT_VLAN_LOOPED: A loop was detect

ed on Bridge-Aggregation5 in VLAN 100.

%Aug  1 03:28:48:290 2019 DeviceA LPDT/5/LPDT_VLAN_RECOVERED: A loop was rem

oved on Bridge-Aggregation4 in VLAN 100.

%Aug  1 03:28:48:291 2019 DeviceA LPDT/5/LPDT_RECOVERED: All loops were remo

ved on Bridge-Aggregation4.

%Aug  1 03:28:48:302 2019 DeviceA LPDT/5/LPDT_VLAN_RECOVERED: A loop was rem

oved on Bridge-Aggregation5 in VLAN 100.

%Aug  1 03:28:48:304 2019 DeviceA LPDT/5/LPDT_RECOVERED: All loops were remo

ved on Bridge-Aggregation5.

使用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

  Bridge-Aggregation4             Shutdown        100

  Bridge-Aggregation5             Shutdown        100

由此可見,Device A上顯示在聚合組4和聚合組5上檢測到環路,由於環路檢測功能運行在Shutdown模式下,聚合組4和聚合組5上出現環路後均已被自動關閉,因此設備打印的日誌信息顯示這兩個聚合組上的環路已消除。此時,使用display interface命令分別查看Device A上聚合組4和聚合組5的狀態信息:

# 顯示Device A上聚合組4的狀態信息。

[DeviceA] display interface Bridge-Aggregation 4

Bridge-Aggregation4

The interface has assigned a M-LAG group.

Current state: DOWN (Loopback detection down)

...

# 顯示Device A上聚合組5的狀態信息。

[DeviceA] display interface Bridge-Aggregation 5

Bridge-Aggregation5

The interface has assigned a M-LAG group.

Current state: DOWN (Loopback detection down)

...

由此可見,聚合組4和聚合組5均已被環路檢測模塊自動關閉。

Device B上的現象和Device A上一致。

 

不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!

BOB登陆
官網
聯係我們