Monday, April 5, 2010


Spanning-Tree Protocol was created a long time ago. Back then, there was no demand for immediate failover. A link typically goes through these stages when it is plugged in:
Listening (15 Seconds)
Learning (15 Seconds)

In the listening stage, it sends and receives BPDUs. This is the loop prevention mechanism. It takes 15 seconds to complete.

Next, the switch goes into the learning stage. In the learning stage, it would listen to MAC addresses and populate the CAM table. This takes another 15 seconds.

Finally, the switch forwards.

Now, if a link goes down, and a backup is required, it would first wait for the MAX-AGE of the dropped link to time out. This MAX-AGE timer is a mechanism to deal with flapping interfaces. However, this would add up to 20 seconds of wait before the switch notifies of a topology change to shift the backup into listening stage.

If the PC boots faster than 30 seconds, the port would not be in forwarding when the PC sends out DHCP requests. If the computer belongs to a domain, he would not be able to connect to the domain and he would need to restart once. To fix this, we would need to turn on portfast. Portfast actually disables spanning-tree on a port, which shifts it into FWD immediately when anything is plugged in.

To turn on portfast, go under the interface and type:
spanning-tree portfast

The first enhancement to STP is the PVST+. PVST stands for per-VLAN spanning tree. It allows a different root bridge for each VLAN. Remember that we have three different VLANs:
10 - Sales
20 - Marketing
30 - Engineering

We can actually make S1 the root bridge for Sales, S2 the root bridge for Marketing, and S3 the root bridge for Engineering. PVST is on by default, you would just have to change the root bridge manually. To do this, enter the commands in the correct switches:
spanning-tree vlan 1 root primary
spanning-tree vlan 10 root primary
spanning-tree vlan 20 root primary
spanning-tree vlan 30 root primary

Now you would have one STP topology for each VLAN.

Rapid Spanning-Tree Protocol (802.1w) is an enhanced version of STP which is more proactive. In the original STP, blocked ports are forgotten. When the active link fails, the switch will go into a reactive state where it goes through the stages.

In RSTP, blocked ports are not forgotten. Blocked ports are actually remembered as backup and are put in use immediately when the active link goes down. RSTP redefines the port roles, but otherwise have many STP similarities. RSTP will have to be implemented everywhere.

The roles in RSTP are:
-Root Port: Used to reach the root bridge
-Designated Port: Forwarding port, one per link
-Alternate Port (New): Discarding port, backup path to root

To turn on RSTP, go under Global Configuration and type:
spanning-tree mode rapid-pvst

RVST still goes through the stages, but can now failover much quicker than before. Do note that whenever there is a failure, ports that are not portfast and are not part of the STP topology will go through the stages. You would need portfast for it to failover quickly.

No comments :

Post a Comment