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?
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.