Wednesday, June 17, 2009

STP and RSTP

Because of the limitations of Spanning-tree Protocol, Cisco added a few options to make it work better - and more "Cisco-like."

When an access port becomes connected to a workstation, it will take up to 50 seconds while it goes through the transition from blocking to listening to learning to forwarding. While it is transitioning, network services are unavailable. This can be a problem if you are in a Windows network where your authentication and DHCP services require a connection and may time out before they complete. To get around this, Cisco added portfast to STP. Portfast essentially tells the switch port to go straight to skip the process and go straight to forwarding. This could be dangerous if the new device is changed out to be a switch, so Cisco added BPDU-guard. BPDU-guard says that, should a switch port receive a BPDU, it sets the port immediately into a blocking state until re-enabled by an administrator.

Two other optional parameters Cisco added to STP are Uplink Fast and Backbone Fast. Uplink Fast sets a port in the access-layer of infrastructure ready to become the root port should it's existing port fail. It has ready knowledge of the alternate path and bypasses the listening and learning states in the event of a failure. Backbone Fast is similar, but it has no direct knowledge of a link to the root. When the backbone link fails, the non-root bridge starts sending BPDU's that it is the new root. The access-layer switch essentially bypasses the listening state, disregards the false BPDU from the non-root bridge and sends a BPDU to the non-root that it has a path to the actual root bridge.

Because these are Cisco-proprietary, the IEEE developed 802.1w, or Rapid Spanning Tree Protocol. RSTP incorporates these features by changing some of the port states and shortening the timers. It changes "blocking" ports to be called "discarding" ports, but because "listening" ports in STP are essentially discarding packets, it lumps that state into discarding. Discarding ports are listening for and forwarding BPDU's but do not forward frames or learn MAC addresses. Learning and forwarding remain the same.

RSTP also adds two port roles. It adds "Alternate" and "Backup" roles to the root and designated port roles. Backup ports are set to assume the role of designated port should the designated port link fail and there are multiple links to that segment (not necessarily to the root). Alternate ports are set to assume the role of root port should the root port link fail.

RSTP also defines a distinction between connections to switches and edge devices differently. Any 100 Mb, full-duplex connection to a switch is defined as a point-to-point link, where half-duplex connections are link-type "shared." Shared link types would take place to a hub, but these are not common any longer so there is no need to worry about them. It then defines access ports as "edge" ports. Edge ports are connected to end devices, and you define them as such by issuing the "switchport portfast" command. If an edge link receives a BPDU, it immediately transitions to point-to-point.

RSTP uses BPDU's as keep-alives, and to aid in rapid convergence, if 3 BPDU's are missed, the switch is considered dead and it floods the BPDU out to all switches (compared to STP sending that TCN to the root and letting the root alert the others) and all switches then age-out any MAC addresses associated with the failed switch. That is quite a lot faster than STP's 50 second wait time.

Lastly, there is a proposal process that neighboring switches go through. When two switches are connected, the send BPDU hello messages to each other. As soon as one decides it is the designated port for that segment, it sends a proposal to forward to the other switch. The receiving switch puts all other non-edge-type ports into a discarding state to avoid loops, and responds that it will accept frames from the sender and becomes the root port. If a switch receives a BPDU from a switch but its path is not optimal to the root, it never sends an agreement so the sender will age out its proposal and become the alternate port and continues to discard.

My understanding is that RSTP configuration is beyond the scope of the CCNA, but it's good to have understanding of how it works to speed up convergence and to know the terms. There you have it folks...

No comments: