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 IPB备设备配置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 核心与业务成员口配置这是整个配置的精髓。我们需要配置RGRedundancy 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 4802. 业务成员口配置以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 xxB备设备注意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 // 指向备设备优先级250B备设备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避坑指南MAC一致性是灵魂V-STP配置中主备设备的bridge-address必须完全一致否则下游交换机无法将其识别为同一台设备极易引发STP环路。Keepalive口必须关STPKeepalive心跳报文如果被STP阻塞会导致MC-LAG误判对端宕机引发业务中断。退避机制要合理配置mc-lag track和exempt非常关键。当Peer-Link断开时备设备会主动Down掉业务口退避但如果Keepalive还在说明对端没死此时Keepalive口不能被Down掉否则心跳也会断。三层逃生是底线在生产环境中永远不要假设Peer-Link和心跳线绝对可靠。配置好三层逃生路由是防止“脑裂”导致全网瘫痪的最后一道防线。希望这篇详尽的MC-LAG配置指南能帮到你如果在实操中遇到报错或状态异常欢迎在评论区留言探讨。如果觉得有用别忘了点赞关注后续还会带来更多硬核网络实战