M-LAG定义
M-LAG(Multichassis Link Aggregation Group)即跨设备链路聚合组。可以解决网络中单台设备故障或一条聚合链路故障时,业务系统的连续性运行。如图1所示,M-LAG将ServerA与DeviceA、DeviceB进行跨设备链路聚合,如同ServerA和一台设备建立了链路聚合关系,从而把链路可靠性从单板级提高到了设备级。
M-LAG具备以下优势:
1)M-LAG系统的两台设备在逻辑上被虚拟为一台设备,提供了一种没有环路的二层拓扑,提升了设备和链路可靠性。
2)M-LAG两台设备可以独立升级,升级过程中,业务系统无感知。
M-LAG工作模式
在M-LAG建立过程中,根据主备M-LAG成员口产生方式的不同,可以将M-LAG工作模式分为:双活模式和主备模式。
1、双活模式
如图2所示,在两台独立的设备DeviceA和DeviceB上,建立一个跨设备的Eth-Trunk与用户侧设备DeviceC的普通Eth-Trunk并通过M-LAG机制进行对接,共同组成一个M-LAG系统。双活模式下,DeviceA和DeviceB通过动态交换服务组DFS Group(Dynamic Fabric Service Group),进行M-LAG设备配对,协商出M-LAG主备设备和M-LAG成员口的主备状态,同时进行表项同步。DeviceA和DeviceB的直连链路为peer-link链路,用于交换协商报文及转发部分流量,peer-link口默认加入所有VLAN和BD。M-LAG成员口即DeviceA和DeviceB上连接用户侧DeviceC的Eth-Trunk接口,用于流量接入。
双活模式下,两条链路一方面可以起到负载分担流量转发的作用,一方面可以起到备份保护的作用。
2、主备模式
如图3所示,在两台独立的设备DeviceA和DeviceB上,建立一个跨设备的Eth-Trunk与用户侧服务器Server并通过M-LAG机制进行对接,共同组成一个M-LAG系统。主备模式下,DeviceA和DeviceB通过动态交换服务组DFS Group,进行M-LAG设备配对,协商出M-LAG主备设备和选举出主备M-LAG成员口,同时进行表项同步。DeviceA和DeviceB的直连链路为peer-link链路,用于交换协商报文及转发部分流量,peer-link口默认加入所有VLAN和BD。M-LAG成员口即DeviceA和DeviceB上连接用户侧Server的主备网卡,用于流量接入。
主备模式仅适用于服务器主备网卡接入M-LAG场景,两条链路可以起到备份保护的作用,但没有负载分担的作用。正常情况下,仅主网卡对接的M-LAG设备收发流量,备网卡对接的M-LAG设备收到流量后,通过peer-link口绕行到主网卡对接的M-LAG设备;当服务器主网卡对接的M-LAG成员口状态变为Down时,流量从peer-link口引流到备网卡对接的M-LAG设备,流量通过备M-LAG成员口直接转发给服务器,完成快速切换,提高服务器主备网卡接入M-LAG场景下的故障切换丢包性能。
不管是双活模式还是主备模式,M-LAG建立过程都分为以下几个步骤:
(1)DFS Group配对
DFS Group是动态交换服务组,主要用于实现DeviceA和DeviceB设备之间的配对。当M-LAG两端设备完成配置后,设备首先通过peer-link链路(必须为聚合链路)发送DFS Group的Hello报文。当设备收到对端的Hello报文后,会判断报文中携带的DFS Group编号是否和本端相同,如果两台设备的DFS Group编号相同,则两台设备DFS Group配对成功。
(2)DFS Group协商主备
配对成功后,两台设备会向对端发送DFS Group的设备信息报文,设备根据报文中携带的DFS Group优先级以及系统MAC地址确定出DFS Group的主备状态。DFS Group的角色分为DFS主设备(M-LAG主设备)和DFS备设备(M-LAG备设备)。
以DeviceB为例,当DeviceB收到DeviceA发送的报文时,DeviceB会查看并记录对端信息,然后比较DFS Group的优先级,如果DeviceA的DFS Group优先级高于本端的DFS Group优先级,则确定DeviceA为DFS主设备,DeviceB为DFS备设备。如果DeviceA和DeviceB的DFS Group优先级相同,比较两台设备的MAC地址,确定MAC地址小的一端为DFS主设备。
(3)M-LAG成员接口协商主备
在DFS Group协商出主备状态后,M-LAG的两台设备会通过peer-link链路发送M-LAG设备信息报文,报文中携带了M-LAG成员口的配置信息。在成员口信息同步完成后,确定M-LAG成员口的主备状态。
与对端同步成员口信息时,状态由Down先变为Up的M-LAG成员口成为主M-LAG成员口,对端对应的M-LAG成员口为备M-LAG成员口,且主备状态默认不回切,即:如果M-LAG成员口状态为主的设备故障,则对端对应的M-LAG成员口从备状态升级为主状态;当M-LAG成员口状态为主的设备故障恢复后,先前由备状态升级为主状态的接口仍保持主状态,恢复故障的M-LAG成员口状态为备。
(4)双主检测
协商出M-LAG主备设备后,两台设备之间会通过双主检测链路(心跳链路,又称为DAD link,是一条三层互通链路。)按照1s的周期发送M-LAG双主检测报文,当两台设备均能够收到对端发送的报文时,M-LAG系统即开始正常的工作。一旦设备感知peer-link故障,会在双主检测延时时间(缺省值为3s)后,按照200ms的周期发送三个双主检测链路报文进行加速检测,防止误触发双主加速检测,导致一端M-LAG设备端口被Error-Down。
正常情况下,双主检测链路不会参与M-LAG的任何转发行为,只在DFS Group配对失败或者peer-link故障场景下,用于检查是否出现双主的情况,所以即便双主检测失败也不会影响M-LAG正常工作。
注意:双主检测链路和peer-link链路不能共用,若双主检测报文通过peer-link链路转发,peer-link链路Down时,双主检测不能进行,无法触发一端M-LAG设备端口Error Down,可能会导致流量转发异常。
(5)M-LAG同步信息
正常工作后,两台设备之间会通过peer-link链路发送M-LAG同步报文实时同步对端的信息,M-LAG同步报文中包括MAC表项、ARP表项、ND表项等,发送M-LAG成员口的状态,这样任意一台设备故障都不会影响流量的转发,保证正常的业务不会中断。
M-LAG配置
配置思路
1、将DeviceA和DeviceB配置为根桥,配置相同的桥MAC,保证M-LAG主备设备在二层网络中处于根桥地位。
2、分别在DeviceA和DeviceB上配置管理网口的IP地址,且保证能够三层互通,用于M-LAG主备设备间心跳报文的传输。
3、分别在DeviceA和DeviceB上配置M-LAG特性,实现服务器的双归接入。
操作步骤
1、将DeviceA和DeviceB配置为根桥,配置相同的桥MAC。
注意:如果组成M-LAG的设备下行接入的是设备,必须配置根保护功能。
#配置DeviceA
<HUAWEI> system-view
[~HUAWEI] sysname DeviceA
[*HUAWEI] commit
[~DeviceA] stp root primary
[*DeviceA] stp bridge-address 00e0-fc12-3458 //配置根桥的桥MAC(M-LAG主设备的MAC地址)
[*DeviceA] interface eth-trunk 1
[*DeviceA-Eth-Trunk1] trunkport 100ge 1/0/2
[*DeviceA-Eth-Trunk1] trunkport 100ge 1/0/5
[*DeviceA-Eth-Trunk1] stp edged-port enable
[*DeviceA-Eth-Trunk1] commit
[~DeviceA-Eth-Trunk1] quit
#配置DeviceB
<HUAWEI> system-view
[~HUAWEI] sysname DeviceB
[*HUAWEI] commit
[~DeviceB] stp root primary
[*DeviceB] stp bridge-address 00e0-fc12-3458 //配置根桥的桥MAC
[*DeviceB] interface eth-trunk 1
[*DeviceB-Eth-Trunk1] trunkport 100ge 1/0/2
[*DeviceB-Eth-Trunk1] trunkport 100ge 1/0/5
[*DeviceB-Eth-Trunk1] stp edged-port enable
[*DeviceB-Eth-Trunk1] commit
[~DeviceB-Eth-Trunk1] quit
2、分别配置DeviceA和DeviceB管理网口的IP地址。
注意:DeviceA和DeviceB管理网口需要保证能够三层互通。
#配置DeviceA
[~DeviceA] interface meth 0/0/0
[~DeviceA-MEth0/0/0] ip address 10.1.1.1 24
[*DeviceA-MEth0/0/0] quit
[*DeviceA] commit
#配置DeviceB
[~DeviceB] interface meth 0/0/0
[~DeviceB-MEth0/0/0] ip address 10.1.1.2 24
[*DeviceB-MEth0/0/0] quit
[*DeviceB] commit
3、在DeviceA和DeviceB上分别创建DFS并绑定管理网口的IP地址。
#配置DeviceA
[~DeviceA] dfs-group 1
[*DeviceA-dfs-group-1] dual-active detection source ip 10.1.1.1 peer 10.1.1.2
[*DeviceA-dfs-group-1] priority 150
[*DeviceA-dfs-group-1] authentication-mode hmac-sha256 password YsHsjx_202206
[*DeviceA-dfs-group-1] quit
[*DeviceA] commit
#配置DeviceB
[~DeviceB] dfs-group 1
[*DeviceB-dfs-group-1] dual-active detection source ip 10.1.1.2 peer 10.1.1.1
[*DeviceB-dfs-group-1] priority 120
[*DeviceB-dfs-group-1] authentication-mode hmac-sha256 password YsHsjx_202206
[*DeviceB-dfs-group-1] quit
[*DeviceB] commit
4、配置DeviceA和DeviceB之间的peer-link。
# 配置DeviceA
[~DeviceA] interface eth-trunk 0
[*DeviceA-Eth-Trunk0] mode lacp-static
[*DeviceA-Eth-Trunk0] trunkport 100ge 1/0/3
[*DeviceA-Eth-Trunk0] trunkport 100ge 1/0/4
[*DeviceA-Eth-Trunk0] undo stp enable
[*DeviceA-Eth-Trunk0] peer-link 1
[*DeviceA-Eth-Trunk0] quit
[*DeviceA] commit
# 配置DeviceB
[~DeviceB] interface eth-trunk 0
[*DeviceB-Eth-Trunk0] mode lacp-static
[*DeviceB-Eth-Trunk0] trunkport 100ge 1/0/3
[*DeviceB-Eth-Trunk0] trunkport 100ge 1/0/4
[*DeviceB-Eth-Trunk0] undo stp enable
[*DeviceB-Eth-Trunk0] peer-link 1
[*DeviceB-Eth-Trunk0] quit
[*DeviceB] commit
5、配置DeviceA和DeviceB连接服务器的Eth-Trunk接口加入VLAN 11并绑定DFS Group。服务器上行连接交换机的端口需要绑定在一个聚合链路中且链路聚合模式需要和交换机侧的聚合模式匹配,以交换机侧配置为静态LACP模式为例。
# 配置DeviceA
[~DeviceA] vlan batch 11
[*DeviceA] interface eth-trunk 1
[*DeviceA-Eth-Trunk1] mode lacp-static
[*DeviceA-Eth-Trunk1] port link-type access
[*DeviceA-Eth-Trunk1] port default vlan 11
[*DeviceA-Eth-Trunk1] dfs-group 1 m-lag 1
[*DeviceA-Eth-Trunk1] quit
[*DeviceA] commit
# 配置DeviceB
[~DeviceB] vlan batch 11
[*DeviceB] interface eth-trunk 1
[*DeviceB-Eth-Trunk1] mode lacp-static
[*DeviceB-Eth-Trunk1] port link-type access
[*DeviceB-Eth-Trunk1] port default vlan 11
[*DeviceB-Eth-Trunk1] dfs-group 1 m-lag 1
[*DeviceB-Eth-Trunk1] quit
[*DeviceB] commit
6、配置DeviceA和DeviceC之间链路以及DeviceB和DeviceD之间链路,并配置接口类型和通过的VLAN。
# 配置DeviceA
[~DeviceA] interface eth-trunk 2
[*DeviceA-Eth-Trunk2] mode lacp-static
[*DeviceA-Eth-Trunk2] port link-type trunk
[*DeviceA-Eth-Trunk2] port trunk allow-pass vlan 11
[*DeviceA-Eth-Trunk2] trunkport 100ge 1/0/1
[*DeviceA-Eth-Trunk2] trunkport 100ge 2/0/0
[*DeviceA-Eth-Trunk2] quit
[*DeviceA] commit
# 配置DeviceB
[~DeviceB] interface eth-trunk 2
[*DeviceB-Eth-Trunk2] mode lacp-static
[*DeviceB-Eth-Trunk2] port link-type trunk
[*DeviceB-Eth-Trunk2] port trunk allow-pass vlan 11
[*DeviceB-Eth-Trunk2] trunkport 100ge 1/0/1
[*DeviceB-Eth-Trunk2] trunkport 100ge 2/0/0
[*DeviceB-Eth-Trunk2] quit
[*DeviceB] commit
# 配置DeviceC
<HUAWEI> system-view
[~HUAWEI] sysname DeviceC
[*HUAWEI] commit
[~DeviceC] vlan batch 11
[~DeviceC] interface eth-trunk 2
[*DeviceC-Eth-Trunk2] mode lacp-static
[*DeviceC-Eth-Trunk2] port link-type trunk
[*DeviceC-Eth-Trunk2] port trunk allow-pass vlan 11
[*DeviceC-Eth-Trunk2] trunkport 100ge 1/0/1
[*DeviceC-Eth-Trunk2] trunkport 100ge 1/0/2
[*DeviceC-Eth-Trunk2] quit
[*DeviceC] commit
# 配置DeviceD
<HUAWEI> system-view
[~HUAWEI] sysname DeviceD
[*HUAWEI] commit
[~DeviceD] vlan batch 11
[~DeviceD] interface eth-trunk 2
[*DeviceD-Eth-Trunk2] mode lacp-static
[*DeviceD-Eth-Trunk2] port link-type trunk
[*DeviceD-Eth-Trunk2] port trunk allow-pass vlan 11
[*DeviceD-Eth-Trunk2] trunkport 100ge 1/0/1
[*DeviceD-Eth-Trunk2] trunkport 100ge 1/0/2
[*DeviceD-Eth-Trunk2] quit
[*DeviceD] commit
检查配置结果
# 查看DFS Group编号为1的M-LAG信息。
[~DeviceA] display dfs-group 1 m-lag
* : Local node
Heart beat state : OK
Node 1 *
Dfs-Group ID : 1
Priority : 150
Dual-active Address : 10.1.1.1
VPN-Instance :public net
State : Master
Causation : -
System ID : 00e0-fc12-3456
SysName : DeviceA
Version : V300R023C00
Device Type : CE16800
Node 2
Dfs-Group ID : 1
Priority : 120
Dual-active Address : 10.1.1.2
VPN-Instance :public net
State : Backup
Causation : -
System ID : 00e0-fc12-3457
SysName : DeviceB
Version : V300R023C00
Device Type : CE16800
# 查看DeviceA上的M-LAG信息。
[~DeviceA] 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
7 -- LACP system-id of M-LAG is inconsistent
8 -- LACP priority of M-LAG is inconsistent
9 -- STP port edged configuration is inconsistent
10 -- M-LAG mode configuration is inconsistent
# 查看DeviceB上的M-LAG信息。
[~DeviceB] 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
7 -- LACP system-id of M-LAG is inconsistent
8 -- LACP priority of M-LAG is inconsistent
9 -- STP port edged configuration is inconsistent
10 -- M-LAG mode configuration is inconsistent
通过以上显示信息可以看到,“Heart beat state”的状态是“OK”,表明心跳状态正常;DeviceA作为Node 1,优先级为150,“State”的状态是“Master”;DeviceB作为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的配置正确。