配置思路
-
將SwitchA和SwitchB配置為根橋,配置相同的橋ID,保證M-LAG主備裝置在二層網路中處於根橋地位。
-
分別在SwitchA和SwitchB上配置管理網口的IP地址,且保證能夠三層互通,用於M-LAG主備裝置間心跳報文的傳輸。
-
分別在SwitchA和SwitchB上配置M-LAG特性,實現伺服器的雙歸接入。
-
在SwitchC和SwitchD上建立VLANIF介面並配置IP地址,在VLANIF介面上建立VRRP備份組,作為M-LAG主備裝置的閘道器。
操作步驟
- 將SwitchA和SwitchB配置為根橋,配置相同的橋ID
如果組成M-LAG的裝置下行接入的是交換裝置,必須配置根保護功能。
# 配置SwitchA。
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] stp root primary [*SwitchA] stp bridge-address 39-39-39 [*SwitchA] interface eth-trunk 1 [*SwitchA-Eth-Trunk1] trunkport 10ge 1/0/5 [*SwitchA-Eth-Trunk1] trunkport 10ge 1/0/6 [*SwitchA-Eth-Trunk1] stp edged-port enable [*SwitchA-Eth-Trunk1] commit [~SwitchA-Eth-Trunk1] quit
# 配置SwitchB。
<HUAWEI> system-view [~HUAWEI] sysname SwitchB [*HUAWEI] commit [~SwitchB] stp root primary [*SwitchB] stp bridge-address 39-39-39 [*SwitchB] interface eth-trunk 1 [*SwitchB-Eth-Trunk1] trunkport 10ge 1/0/5 [*SwitchB-Eth-Trunk1] trunkport 10ge 1/0/6 [*SwitchB-Eth-Trunk1] stp edged-port enable [*SwitchB-Eth-Trunk1] commit [~SwitchB-Eth-Trunk1] quit
- 分別配置SwitchA和SwitchB管理網口的IP地址
# 配置SwitchA。
[~SwitchA] interface meth 0/0/0 [~SwitchA-MEth0/0/0] ip address 10.1.1.1 24 [*SwitchA-MEth0/0/0] quit [*SwitchA] commit
# 配置SwitchB。
[~SwitchB] interface meth 0/0/0 [~SwitchB-MEth0/0/0] ip address 10.1.1.2 24 [*SwitchB-MEth0/0/0] quit [*SwitchB] commit
- 在SwitchA和SwitchB上分別建立DFS並繫結管理網口的IP地址
SwitchA和SwitchB管理網口需要保證能夠三層互通。
# 配置SwitchA。
[~SwitchA] dfs-group 1 [*SwitchA-dfs-group-1] source ip 10.1.1.1 [*SwitchA-dfs-group-1] priority 150 [*SwitchA-dfs-group-1] quit [*SwitchA] commit
# 配置SwitchB。
[~SwitchB] dfs-group 1 [*SwitchB-dfs-group-1] source ip 10.1.1.2 [*SwitchB-dfs-group-1] priority 120 [*SwitchB-dfs-group-1] quit [*SwitchB] commit
- 配置SwitchA和SwitchB之間的Peer-link
# 配置SwitchA。
[~SwitchA] interface eth-trunk 0 [*SwitchA-Eth-Trunk0] trunkport 10ge 1/0/3 [*SwitchA-Eth-Trunk0] trunkport 10ge 2/0/4 [*SwitchA-Eth-Trunk0] undo stp enable [*SwitchA-Eth-Trunk0] mode lacp-static [*SwitchA-Eth-Trunk0] peer-link 1 [*SwitchA-Eth-Trunk0] quit [*SwitchA] commit
# 配置SwitchB。
[~SwitchB] interface eth-trunk 0 [*SwitchB-Eth-Trunk0] trunkport 10ge 1/0/3 [*SwitchB-Eth-Trunk0] trunkport 10ge 2/0/4 [*SwitchB-Eth-Trunk0] undo stp enable [*SwitchB-Eth-Trunk0] mode lacp-static [*SwitchB-Eth-Trunk0] peer-link 1 [*SwitchB-Eth-Trunk0] quit [*SwitchB] commit
- 配置SwitchA和SwitchB連線伺服器的Eth-Trunk介面加入VLAN 11並繫結DFS Group
伺服器上行連線交換機的埠需要繫結在一個聚合鏈路中且鏈路聚合模式需要和交換機側的聚合模式匹配。
# 配置SwitchA。
[~SwitchA] vlan batch 11 [*SwitchA] interface eth-trunk 1 [*SwitchA-Eth-Trunk1] mode lacp-dynamic [*SwitchA-Eth-Trunk1] port link-type access [*SwitchA-Eth-Trunk1] port default vlan 11 [*SwitchA-Eth-Trunk1] dfs-group 1 m-lag 1 [*SwitchA-Eth-Trunk1] quit [*SwitchA] commit
# 配置SwitchB。
[~SwitchB] vlan batch 11 [*SwitchB] interface eth-trunk 1 [*SwitchB-Eth-Trunk1] mode lacp-dynamic [*SwitchB-Eth-Trunk1] port link-type access [*SwitchB-Eth-Trunk1] port default vlan 11 [*SwitchB-Eth-Trunk1] dfs-group 1 m-lag 1 [*SwitchB-Eth-Trunk1] quit [*SwitchB] commit
- 配置SwitchA和SwitchC之間為聚合鏈路以及SwitchB和SwitchD之間為聚合鏈路,並配置介面型別和透過的VLAN
# 配置SwitchA。
[~SwitchA] interface eth-trunk 2 [*SwitchA-Eth-Trunk2] mode lacp-static [*SwitchA-Eth-Trunk2] port link-type trunk [*SwitchA-Eth-Trunk2] port trunk allow-pass vlan 11 [*SwitchA-Eth-Trunk2] trunkport 10ge 1/0/1 [*SwitchA-Eth-Trunk2] trunkport 10ge 1/0/2 [*SwitchA-Eth-Trunk2] quit [*SwitchA] commit
# 配置SwitchB。
[~SwitchB] interface eth-trunk 2 [*SwitchB-Eth-Trunk2] mode lacp-static [*SwitchB-Eth-Trunk2] port link-type trunk [*SwitchB-Eth-Trunk2] port trunk allow-pass vlan 11 [*SwitchB-Eth-Trunk2] trunkport 10ge 1/0/1 [*SwitchB-Eth-Trunk2] trunkport 10ge 1/0/2 [*SwitchB-Eth-Trunk2] quit [*SwitchB] commit
# 配置SwitchC。
<HUAWEI> system-view [~HUAWEI] sysname SwitchC [*HUAWEI] commit [~SwitchC] vlan batch 11 [*SwitchC] interface eth-trunk 2 [*SwitchC-Eth-Trunk2] mode lacp-static [*SwitchC-Eth-Trunk2] port link-type trunk [*SwitchC-Eth-Trunk2] port trunk allow-pass vlan 11 [*SwitchC-Eth-Trunk2] trunkport 10ge 1/0/1 [*SwitchC-Eth-Trunk2] trunkport 10ge 1/0/2 [*SwitchC-Eth-Trunk2] quit [*SwitchC] commit
# 配置SwitchD。
<HUAWEI> system-view [~HUAWEI] sysname SwitchD [*HUAWEI] commit [~SwitchD] vlan batch 11 [*SwitchD] interface eth-trunk 2 [*SwitchD-Eth-Trunk2] mode lacp-static [*SwitchD-Eth-Trunk2] port link-type trunk [*SwitchD-Eth-Trunk2] port trunk allow-pass vlan 11 [*SwitchD-Eth-Trunk2] trunkport 10ge 1/0/1 [*SwitchD-Eth-Trunk2] trunkport 10ge 1/0/2 [*SwitchD-Eth-Trunk2] quit [*SwitchD] commit
- 在SwitchC和SwitchD上建立VLANIF介面並配置IP地址,在VLANIF介面上建立VRRP備份組
# 在SwitchC上建立VRRP備份組1,配置SwitchC在該備份組中的優先順序為120。
[~SwitchC] interface vlanif 11 [*SwitchC-Vlanif11] ip address 10.2.1.1 24 [*SwitchC-Vlanif11] vrrp vrid 1 virtual-ip 10.2.1.111 [*SwitchC-Vlanif11] vrrp vrid 1 priority 120 [*SwitchC-Vlanif11] quit [*SwitchC] commit
# 在SwitchD上建立VRRP備份組1,其在該備份組中的優先順序為預設值100。
[~SwitchD] interface vlanif 11 [*SwitchD-Vlanif11] ip address 10.2.1.2 24 [*SwitchD-Vlanif11] vrrp vrid 1 virtual-ip 10.2.1.111 [*SwitchD-Vlanif11] quit [*SwitchD] commit
- 驗證配置結果
-
執行命令display dfs-group,檢視M-LAG的相關資訊。
# 檢視DFS Group編號為1的M-LAG資訊。
[~SwitchA] display dfs-group 1 m-lag * : Local node Heart beat state : OK Node 1 * Dfs-Group ID : 1 Priority : 150 Address : ip address 10.1.1.1 State : Master Causation : - System ID : 0025-9e95-7c31 SysName : SwitchA Version : V100R006C00 Device Type : CE12800 Node 2 Dfs-Group ID : 1 Priority : 120 Address : ip address 10.1.1.2 State : Backup Causation : - System ID : 0025-9e95-7c11 SysName : SwitchB Version : V100R006C00 Device Type : CE12800
# 檢視SwitchA上的M-LAG資訊。
[~SwitchA] display dfs-group 1 node 1 m-lag brief * - Local node M-Lag ID Interface Port State Status Consistency-check 1 Eth-Trunk 1 Up active(*)-active -- Failed reason: 1 -- Relationship between vlan and port is inconsistent 2 -- STP configuration under the port is inconsistent 3 -- STP port priority configuration is inconsistent 4 -- LACP mode of M-LAG is inconsistent 5 -- M-LAG configuration is inconsistent 6 -- The number of M-LAG members is inconsistent
# 檢視SwitchB上的M-LAG資訊。
[~SwitchA] display dfs-group 1 node 2 m-lag brief * - Local node M-Lag ID Interface Port State Status Consistency-check 1 Eth-Trunk 1 Up active-active(*) -- Failed reason: 1 -- Relationship between vlan and port is inconsistent 2 -- STP configuration under the port is inconsistent 3 -- STP port priority configuration is inconsistent 4 -- LACP mode of M-LAG is inconsistent 5 -- M-LAG configuration is inconsistent 6 -- The number of M-LAG members is inconsistent
透過以上顯示資訊可以看到,“Heart beat state”的狀態是“OK”,表明心跳狀態正常;SwitchA作為Node 1,優先順序為150,“State”的狀態是“Master”;SwitchB作為Node 2,優先順序為120,“State”的狀態是“Backup”。同時“Causation”的狀態是“-”,Node 1的“Port State”狀態為“Up”,Node 2的“Port State”狀態為“Up”,且Node 1和Node 2的M-LAG狀態均為“active”,表明M-LAG的配置正確。
-
在SwitchC和SwitchD上分別執行display vrrp命令,可以看到SwitchC在備份組中的狀態為Master,SwitchD在備份組中的狀態為Backup。
[~SwitchC] display vrrp verbose Vlanif11 | Virtual Router 1 State : Master Virtual IP : 10.2.1.111 Master IP : 10.2.1.1 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 0s Remain : -- TimerRun : 1s TimerConfig : 1s Auth Type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config Type : Normal Create Time : 2020-01-30 11:39:18 Last Change Time : 2020-02-04 11:38:58
[~SwitchD] display vrrp verbose Vlanif11 | Virtual Router 1 State : Backup Virtual IP : 10.2.1.111 Master IP : 10.2.1.1 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0s Remain : -- TimerRun : 1s TimerConfig : 1s Auth Type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config Type : Normal Create Time : 2020-01-30 11:39:18 Last Change Time : 2020-02-04 11:38:58
-
配置檔案
-
SwitchA的配置檔案
# sysname SwitchA # dfs-group 1 priority 150 source ip 10.1.1.1 # vlan batch 11 # stp bridge-address 0039-0039-0039 stp instance 0 root primary # interface MEth0/0/0 ip address 10.1.1.1 255.255.255.0 # interface Eth-Trunk0 stp disable mode lacp-static peer-link 1 # interface Eth-Trunk1 port default vlan 11 stp edged-port enable mode lacp-dynamic dfs-group 1 m-lag 1 # interface Eth-Trunk2 port link-type trunk port trunk allow-pass vlan 11 mode lacp-static # interface 10GE1/0/1 eth-trunk 2 # interface 10GE1/0/2 eth-trunk 2 # interface 10GE1/0/3 eth-trunk 0 # interface 10GE1/0/5 eth-trunk 1 # interface 10GE1/0/6 eth-trunk 1 # interface 10GE2/0/4 eth-trunk 0 # return
-
SwitchB的配置檔案
# sysname SwitchB # dfs-group 1 priority 120 source ip 10.1.1.2 # vlan batch 11 # stp bridge-address 0039-0039-0039 stp instance 0 root primary # interface MEth0/0/0 ip address 10.1.1.2 255.255.255.0 # interface Eth-Trunk0 stp disable mode lacp-static peer-link 1 # interface Eth-Trunk1 port default vlan 11 stp edged-port enable mode lacp-dynamic dfs-group 1 m-lag 1 # interface Eth-Trunk2 port link-type trunk port trunk allow-pass vlan 11 mode lacp-static # interface 10GE1/0/1 eth-trunk 2 # interface 10GE1/0/2 eth-trunk 2 # interface 10GE1/0/3 eth-trunk 0 # interface 10GE1/0/5 eth-trunk 1 # interface 10GE1/0/6 eth-trunk 1 # interface 10GE2/0/4 eth-trunk 0 # return
-
SwitchC的配置檔案
# sysname SwitchC # vlan batch 11 # interface Vlanif11 ip address 10.2.1.1 255.255.255.0 vrrp vrid 1 virtual-ip 10.2.1.111 vrrp vrid 1 priority 120 # interface Eth-Trunk2 port link-type trunk port trunk allow-pass vlan 11 mode lacp-static # interface 10GE1/0/1 eth-trunk 2 # interface 10GE1/0/2 eth-trunk 2 # return
-
SwitchD的配置檔案
# sysname SwitchD # vlan batch 11 # interface Vlanif11 ip address 10.2.1.2 255.255.255.0 vrrp vrid 1 virtual-ip 10.2.1.111 # interface Eth-Trunk2 port link-type trunk port trunk allow-pass vlan 11 mode lacp-static # interface 10GE1/0/1 eth-trunk 2 # interface 10GE1/0/2 eth-trunk 2 # return
-