Spanning Tree Theory 1

Jami Ullah Lv2Posted 29 Jul 2023 18:27

Last edited by Jami Ullah 02 Aug 2023 16:57.

Spanning Tree

Spanning Tree Protocol (STP) is a control plane mechanism designed for Ethernet networks. Its primary purpose is to create a Layer 2 topology resembling a tree structure, with the root switch positioned at the top.

Given that classical Ethernet operates using data plane learning and lacks TTL in Ethernet frames to prevent loops, STP comes into play by blocking certain links to avoid potential loops.

However, this approach of mitigating loops through link blocking has its drawbacks. It limits the active utilization of available links and eliminates the possibility of multipathing.


Access-Distribution Switches and STP

In the depicted topology, the Access switches on the right distribution link are blocked to prevent a Layer 2 forwarding loop.

A downside of STP is its inability to facilitate flow-basedload balancing. In Layer 2 networks, two common load balancing techniques areemployed: VLAN-based and flow-based load balancing.

Inlayer 2 switching, the Ethernet frames should be received from the same portwhere it was sent, otherwise layer 2 switching or switching loop occurs. Let meexplain this concept with the topology depicted below.

Vlan-based load balancing

In the diagram above, traffic can be sent through eitherPort 1 or Port 2, but it must be received on the same port. MAC addresses areused by the switches to process the Ethernet frames.

The switch cannot observe the same MAC address from two different ports simultaneously. In other words, Switch 1 cannot receive thesame MAC address from both Port 1 and Port 2.

To address this issue, both ports can be grouped into abundle, which is commonly referred to as Link Aggregation Group (LAG) orEtherchannel/Port Channel based on vendor terms.

In cases where Switch 1 is connected to two different switches, such as Switch 2 and Switch 3, Multi Chassis Link Aggregation Group(MLAG) or Multi Chassis Etherchannel (MEC) can be set up between the switches.

On the other hand, Spanning Tree Protocol (STP) resolvesthis problem by disabling one of the ports. For instance, if Port 1 sends the frame, Port 2 is disabled.

The functioning of Spanning Tree involves selecting the rootswitch. One of the switches is elected as the root, and all its ports remain inthe forwarding state. Consequently, ports connected to or coming from the roots witch cannot be blocked.

In the given topology, if Switch 2 is designated as the root switch (either manually by the administrator or dynamically based on the smallest MAC address), Switch 3 becomes the backup-root switch. In the event of Switch 2 failure, Switch 3 assumes full responsibility for the operation.

When Switch 2 is the root switch, the link from Switch 1 to Switch 3 is disabled by Spanning Tree, meaning it is physically up but layer 2 down.

In networks with multiple VLANs, employing Port 1 of the Switch 1 to Switch 2 links for some VLANs and Port 2 for other VLANs allows for utilizing all available links. This is known as VLAN-based load balancing.

To elaborate, all the ports of the root switch must be upfrom the Spanning Tree perspective, so the Switch 1 to Switch 3 link is blocked to eliminate the loop. Consequently, the VLANs' Switch 1 to Switch 3 link isput to use by assigning a root switch role to different switches in that scenario.

Switch 2 becomes the root switch for some VLANs, while Switch 3 takes on the role for other VLANs, and they act as backup roots witches for each other.

Various Spanning Tree implementations exist, including CST(Common Spanning Tree), PVST (Per VLAN Spanning Tree), RSTP (Rapid SpanningTree), RPVST (Rapid Per VLAN Spanning Tree), and MST (Multiple Spanning Tree).

CST, an IEEE standard (802.1d), does not permit different root switches for different VLANs, meaning all VLANs in the network must be assigned to the same root switch.

On the other hand, PVST, RPVST, and MST support VLAN-basedload balancing, enabling different VLANs to be assigned to different root switches. However, RSTP (802.1w) does not offer VLAN-based load balancing.

Flow-based load balancing finds its primary application inLayer 2 networks, while in Layer 3 routing, load balancing can be performed ona per-packet or per-flow basis. Flow-based load balancing is particularly prevalent in Local Area Networks (LANs), data centers, and data center interconnect technologies.
Flow based load balancing

Imagine a scenario where you have 10 VLANs, and Switch2 serves as the root switch for all of them. Each VLAN contains numerous hosts.

If the link between Switch2 and Switch3 is a Layer 3 link,Spanning Tree Protocol (STP) doesn't block any links in this topology, resulting in a Layer 2 loop-free configuration.

STP is responsible for handling the logical Layer 2 topology, while the Layer 3 part, which involves the default gateway functionality, relies on first hop redundancy mechanisms like HSRP (Hot Standby Router Protocol), VRRP (Virtual Router Redundancy Protocol), or GLBP (Gateway Load Balancing Protocol).

When using HSRP or VRRP, one of the switches can act as the primary gateway for a specific VLAN, with the other switch serving as the standby. For instance, Switch 2 might be the primary gateway for VLAN 5, while Switch 3 functions as the standby. Similarly, for VLAN 6, Switch 3 can be theprimary gateway, and Switch 2 becomes the standby. This configuration enablesthe utilization of all uplinks on Switch1, ensuring that bandwidth isefficiently utilized.

HSRP and VRRP, therefore, enable VLAN-based load balancing. Each VLAN's default gateway can be assigned to only one of the switches at a time.

On the other hand, using GLBP in this topology allows both Switch 2 and Switch 3 to act as default gateways for a given VLAN. For different hosts within the same VLAN, ARP replies are sent by different switches.

For instance, Switch 2 might serve as the default gateway for host 1 in VLAN 5, while Switch 3 is the default gateway for host 2 in the sameVLAN.

Consequently, traffic for different sets of hosts within the same VLAN can be simultaneously sent from Switch 1 to both Switch 2 and Switch 3.

A "flow" in this context does not represent a host itself but refers to a sequence of packets sharing similar characteristics, such as the same destination IP address and port numbers. Therefore, trafficfor different flows of host 1 in VLAN 5 can be directed to both Switch 2 andSwitch 3.

Like this topic? Like it or reward the author.

Creating a topic earns you 5 coins. A featured or excellent topic earns you more coins. What is Coin?

Enter your mobile phone number and company name for better service. Go

Tayyab0101 Lv2Posted 29 Jul 2023 18:49
Very nice worth reading
Zonger Lv3Posted 29 Jul 2023 18:55
Interesting share
Faisal P Posted 30 Jul 2023 00:01
Thank you very much for the information ...
Jami Ullah Lv2Posted 30 Jul 2023 13:33
Thanks all for your showing your confidence.  Will keep posting design level articles to benefit community & it's members.