Can link aggregation be a substitute for STP protocol? I mean can I use 2 links with Link Aggregation to connect two switches for higher availability as an alternative to STP protocol?
1Link aggregation actually fools STP into treating the multiple member links as a single link. Normally, STP would shut all but one of the links, but link aggregation tells STP that the virtual link interface is the one and only interface among the group.– Ron Maupin ♦Jun 7, 2020 at 16:28
Yes, LAGs can be a substitute for xSTP.
Generally, LAGs are a better and less-complex choice than having the same links without configuring them as a LAG.
You can also run xSTP over a LAG. That will often be the case when you have diverse switches in addition to diverse links.
Link aggregation (LAG) and xSTP both enable redundant links without bridge loops, but there are significant differences:
- Any LAG trunk can only connect two switches (there are various multi-chassis LAG variants but they're all proprietary).
- All physical links in a LAG trunk need to use the same speed.
- VLAN settings are by LAG trunk, so you can't vary them between links.
- Traffic distribution across the links is by address hash: MAC addresses, IP addresses, L4 port numbers - depending on hardware and configuration.
- Redundant links with RSTP are blocked and cannot be used for traffic at all.
- MSTP enables you to group VLANs into instances, which each form their own spanning tree. Depending on your workloads, that may allow a more "controlled" traffic distribution.
Most often you need to combine LAG and xSTP. Of course, there's also Shortest Path Bridging from IEEE 802.1aq, but that's not too widely supported yet.
A different approach is to use routed links with L3 interfaces directly on the hardware ports. Their bandwidth may be aggregated by using equal-cost multi-path routing (ECMP) without requiring any special L2 treatment like STP or LAG. ECMP has its own challenges but it may be a good replacement for L2 aggregation/failover in many scenarious.
As my per my knowledge both switches has to run same stp protocol.to ensure your setup to be loopfree
That's often incorrect. Backward-compatibility is an important feature of the IEEE xSTP protocols. However, if you mix proprietary protocols e.g. PVST+ with IEEE protocols it can sometimes be problematic, depending on the specifics. As far as an answer to this poster's question, though, I think your answer may lead them down the wrong path. Aug 15, 2020 at 21:46