MC-LAG与V-STP高可用组网实战配置指南

MC-LAG与V-STP高可用组网实战配置指南

在大型数据中心或高可用网络架构中,MC-LAG(跨机箱链路聚合)是保障业务不中断的“定海神针”。然而,MC-LAG的部署不仅仅是简单的链路捆绑,还需要配合V-STP(虚拟生成树协议)、Keepalive心跳检测、ICCP表项同步以及三层逃生机制,才能构建一个真正健壮的无环、高可靠网络。

今天这篇硬核干货,我将以主备两台设备(A为主,B为备)为例,带大家一步步梳理MC-LAG的完整配置逻辑。内容较多,建议先收藏备用!


一、 V-STP 生成树配置(防环基石)

在MC-LAG组网中,两台设备对外必须表现为一台逻辑设备。因此,我们需要开启V-STP,并将主备设备的桥MAC配置为一致,防止下游设备因MAC不同而产生拓扑震荡。

A主设备 / B备设备配置(保持一致):

spantree enable mode rstp // 配置为RSTP模式,实现秒级收敛 tc-guard enable // 开启TC-BPDU保护,防止拓扑变化风暴 vstp enable // 核心:开启V-STP功能 bridge-address c092.96a0.ed00 // 主备设备桥MAC配置一致(建议取MAC较小者) mst priority 8192 instance 0 // 主备设备优先级保持一致

端口STP策略:

interface smartgroup1 // Peer-Link内部端口 internal-port enable $ interface smartgroup2 // Keepalive心跳端口 disable // 必须关闭STP,防止心跳报文被阻塞 $ interface smartgroup3 // 下联服务器端口 edged-port enable // 配置为边缘端口,实现快速转发 $ interface smartgroup11 // 上行端口 disable // 关闭STP,防止上行环路

二、 Keepalive 心跳链路配置

Keepalive链路用于检测对端设备是否存活。为了防止物理链路抖动导致MC-LAG频繁主备切换,这里我们配置了LACP快速收敛以及Track联动机制。

A主设备配置:

interface smartgroup1023 switch attribute disable yes description For_Keepalived ! interface xgei-0/1/1/47 switch attribute disable yes description For_Keepalived ! interface xgei-0/1/1/48 switch attribute disable yes description For_Keepalived ! smartgroup fast-switch 1023 enable lacp interface smartgroup1023 lacp mode 802.3ad lacp fast respond // 开启LACP快速响应 ! interface xgei-0/1/1/47 smartgroup 1023 mode active ! interface xgei-0/1/1/48 smartgroup 1023 mode active ! ip vrf keepalive rd 1:1 address-family ipv4 ! interface smartgroup1023 ip vrf forwarding keepalive ip address 1.1.1.1 255.255.255.252 // 主设备Keepalive IP ! samgr track zte interface smartgroup1023 // 绑定Track,联动MC-LAG状态

B备设备配置(仅IP不同):

interface smartgroup1023 switch attribute disable yes description For_Keepalived ! interface xgei-0/1/1/47 switch attribute disable yes description For_Keepalived ! interface xgei-0/1/1/48 switch attribute disable yes description For_Keepalived ! smartgroup fast-switch 1023 enable lacp interface smartgroup1023 lacp mode 802.3ad lacp fast respond // 开启LACP快速响应 ! interface xgei-0/1/1/47 smartgroup 1023 mode active ! interface xgei-0/1/1/48 smartgroup 1023 mode active ! ip vrf keepalive rd 1:1 address-family ipv4 ! interface smartgroup1023 ip vrf forwarding keepalive ip address 1.1.1.2 255.255.255.252 // 备设备Keepalive IP ! samgr track zte interface smartgroup1023 // 绑定Track,联动MC-LAG状态

三、 Peer-Link 与 ICCP 控制通道

Peer-Link是MC-LAG的数据与信令大动脉。我们需要将其配置为Trunk,并专门划分一个VLAN(如4094)作为ICCP控制通道。

A主设备配置

interface smartgroup1024 description For_PeerLink ! // 物理成员口加入smartgroup1024并配置为active... ! smartgroup fast-switch 1024 enable lacp interface smartgroup1024 lacp mode 802.3ad lacp fast respond ! lacp peer-link smartgroup1024 // 关键:声明为Peer-Link ! switchvlan-configuration interface smartgroup1024 switchport mode trunk switchport trunk vlan xx // 透传下行业务VLAN switchport trunk native vlan 4094 // ICCP控制VLAN作为Native VLAN acceptable frame types tag ! iccp peerlink vlan 4094 interface vlan 4094 ip address 1.1.1.5 255.255.255.252 // A主设备ICCP IP

B备设备配置

interface smartgroup1024 description For_PeerLink ! // 物理成员口加入smartgroup1024并配置为active... ! smartgroup fast-switch 1024 enable lacp interface smartgroup1024 lacp mode 802.3ad lacp fast respond ! lacp peer-link smartgroup1024 // 关键:声明为Peer-Link ! switchvlan-configuration interface smartgroup1024 switchport mode trunk switchport trunk vlan xx // 透传下行业务VLAN switchport trunk native vlan 4094 // ICCP控制VLAN作为Native VLAN acceptable frame types tag ! iccp peerlink vlan 4094 interface vlan 4094 ip address 1.1.1.6 255.255.255.252 // B主设备ICCP IP

四、 MC-LAG 核心与业务成员口配置

这是整个配置的精髓。我们需要配置RG(Redundancy Group)来同步MAC、ARP、ND和STP表项,并为每个业务接口绑定MC-LAG参数。

1. 全局MC-LAG与RG组配置

A主设备:

mpls ldp instance 1 router-id 1.1.1.5 ! redundancy interchassis group 1 peer 1.1.1.6 apply mac // 同步MAC表项 apply arp // 同步ARP表项 apply nd // 同步ND表项 apply stp // 同步STP状态 ! // 可配置多个RG组... ! lacp mc-lag priority 120 // 主设备优先级设为120(值越小越优先) mc-lag ipv4 source 1.1.1.1 destination 1.1.1.2 vrf keepalive mc-lag track zte peer-type // 绑定Track,断链时检测心跳 mc-lag exempt smartgroup1023 // Keepalive口退避豁免 mc-lag reload-delay-up 480 // 重启延时UP,等待网络稳定

B备设备:

mpls ldp instance 1 router-id 1.1.1.6 ! redundancy interchassis group 1 peer 1.1.1.5 apply mac apply arp apply nd apply stp ! lacp mc-lag priority 150 // 备设备优先级设为150 mc-lag ipv4 source 1.1.1.2 destination 1.1.1.1 vrf keepalive mc-lag track zte peer-type mc-lag exempt smartgroup1023 mc-lag reload-delay-up 480
2. 业务成员口配置(以Smartgroup11为例)

A主设备:

interface smartgroup11 description connect-to-server1 ! lacp interface smartgroup11 lacp mode 802.3ad lacp fast respond ! interface xgei-0/1/1/1 smartgroup 11 mode active ! lacp interface smartgroup11 mc-lag mode force-master mc-lag ipv4 source 1.1.1.1 destination 1.1.1.2 vrf keepalive mc-lag priority 120 mc-lag roid 11 node-id 1 // ROID一致,Node-ID不同(主为1) mc-lag sys-id 0000.5960.0011 sys-priority 111 // 主备Sys-ID和优先级必须一致 ! icbg sg11 bind interface smartgroup11 bind rg 1 bind slave-interface smartgroup1024 // 绑定Peer-Link group-backup-interval 5 ! switchvlan-configuration interface smartgroup11 switchport mode access switchport access vlan xx

B备设备(注意Source/Dest和Node-ID的变化):

// 物理口与LACP配置同上... lacp interface smartgroup11 mc-lag mode force-master mc-lag ipv4 source 1.1.1.2 destination 1.1.1.1 vrf keepalive mc-lag priority 150 mc-lag roid 11 node-id 2 // Node-ID变为2 mc-lag sys-id 0000.5960.0011 sys-priority 111 // Sys-ID与主设备保持一致 ! icbg sg11 bind interface smartgroup11 bind rg 1 bind slave-interface smartgroup1024 group-backup-interval 5 ! ! switchvlan-configuration interface smartgroup11 switchport mode access switchport access vlan xx

(注:Smartgroup12及其他业务口配置逻辑相同,仅需修改对应的ROID、Sys-ID等参数)


五、 三层逃生机制(保障)

当Peer-Link和Keepalive链路同时发生故障(双归节点脑裂)时,为了防止网络环路并保证业务不中断,我们需要配置三层逃生路由。

A主设备:

interface vlan4090 description For_Service-Escape ip address 192.168.1.1 255.255.255.252 ! switchvlan-configuration interface smartgroup1024 switchport mode trunk switchport trunk vlan add 4090 ! ip route 0.0.0.0 0.0.0.0 vlan4090 192.168.1.2 250 // 指向备设备,优先级250

B备设备:

interface vlan4090 description For_Service-Escape ip address 192.168.1.2 255.255.255.252 ! switchvlan-configuration interface smartgroup1024 switchport mode trunk switchport trunk vlan add 4090 ! ip route 0.0.0.0 0.0.0.0 vlan4090 192.168.1.1 250 // 指向主设备,优先级250

避坑指南

  1. MAC一致性是灵魂:V-STP配置中,主备设备的bridge-address必须完全一致,否则下游交换机无法将其识别为同一台设备,极易引发STP环路。
  2. Keepalive口必须关STP:Keepalive心跳报文如果被STP阻塞,会导致MC-LAG误判对端宕机,引发业务中断。
  3. 退避机制要合理:配置mc-lag trackexempt非常关键。当Peer-Link断开时,备设备会主动Down掉业务口(退避);但如果Keepalive还在,说明对端没死,此时Keepalive口不能被Down掉,否则心跳也会断。
  4. 三层逃生是底线:在生产环境中,永远不要假设Peer-Link和心跳线绝对可靠。配置好三层逃生路由,是防止“脑裂”导致全网瘫痪的最后一道防线。

希望这篇详尽的MC-LAG配置指南能帮到你!如果在实操中遇到报错或状态异常,欢迎在评论区留言探讨。如果觉得有用,别忘了点赞关注,后续还会带来更多硬核网络实战!