Tuesday, July 27, 2010

Spanning Tree Protocol

Spanning Tree Protocol is a protocol used in switching to prevent the network from switching loops. This can happen if the source of a subordinate switch has 2 switches above it (usually for redundancy). In this case the subordinate switch can receive information from both switches and can be confused or loop information when there is a problem between the superordinate switches. The STP protocol will prevent that by sending BPDU’s and blocking ports temporary.

Bridge Protocol Data Unit (BPDU) are packets sent between switches every 2 seconds with a multicast destination address which is 01:80:c2:00:00:00. There are 2 types of BPDU which are Configuration BPDU and Topology Change Notification (TCN) BPDU. These BPDUs with the configuration of the root bridge will be sent from the root switch and will be forwarded by the other switches.

Each switch has a Bridge ID (BID) value that will be used to decide the root bridge. The BID consists of priority value (cisco’s default value is 32,768) and the MAC address of the switch. So a default cisco switch with the MAC address of 11:22:33:aa:bb:cc will have a BID of 32768-11:22:33:aa:bb:cc. A root switch will always be the switch with the lowest value. Even in a stable system with a root switch configured in it, the root switch can change if another switch is plugged in with a lower BID value.

To see the STP configuration type the command “show spanning-tree vlan 1” (remember VLAN 1 always exists on a default cisco switch). A pair of switches has been set up with two physical connections to each other and the results shown below.


In the picture above we can see 2 parts for the ID which is the Root ID and the Bridge ID. The Root ID contains information about the Root Bridge of all the switches in that network. In this picture, it can be seen that in the Root ID there is a statement “This bridge is the root”. This means that the current switch is the root switch. There is also a Bridge ID which contains information about the switch’s own ID. Because this switch is the root bridge, the Root ID and Bridge ID are the same. Also because this bridge is the root bridge, all ports are designated ports and are all forward. It can be seen that Fa0/1 and Fa0/2 are the ports on the switch that goes to the other switch.
Pay attention to the priority value. The priority value on that VLAN is the original priority+VLAN number. That can be seen in the priority value which is 32769 that consists of 32768 (original priority in a cisco switch) + 1 for the VLAN number (considered as a sys-id-ext 1). If we see that on VLAN 10 then the priority value will be: "32778 (priority 32768 sys-id-ext 10)".


The picture above (SwitchB) is the pairing switch of SwitchA. I can be seen that the Root ID is the ID of SwitchA. The Bridge ID is the ID of SwitchB itself. It can be seen why SwitchA is considered the Root Bridge; because it has a lower BID value (lower MAC address to be precise). Because there are 2 paths from SwitchA to SwitchB, one of the paths must be blocked, while the other still on forwarding to prevent switching loops. In this case interface Fa0/12 is blocked and will be the Alternate (standby) path while interface Fa0/11 carries the role of the Root Path.

Now this is how STP works in general

No comments:

Post a Comment