Popular Posts

Share |
Showing posts with label Spanning Tree Protocol. Show all posts
Showing posts with label Spanning Tree Protocol. Show all posts

Tuesday, March 23, 2010

802.1d - How the STP functioning ?

Function of Spanning Tree Protocol - 802.1d
At the first I think it's better to have a brief description on STP.

STP is directly responsible for avoid following errors occur in a switched network, where the switches are connected in a loop.

1. Avoid receiving multiple frames of same data to hosts
2. Avoid packets going on an endless loop
3. Make MAC address table steady 

all of above errors are possible to occur in an environment where the STP in not available. STP blocks a selected port on a loop to avoid those errors. The blocking port selected as follows.

STP blocks the designated port of highest cost path bearing switch to the root bridge. Then what are the designated ports and root bridge ?

Bridge ID, BPDU and Root bridge

Every switch has a bridge ID. Bridge ID is a combination of Priority value and lowest MAC address value. Priority value is 32768 by default in catalyst switches and it could be configure manually. The first factor is to consider for bridge ID is priority value. If the value is low, Bridge ID is high. value 1 is the maximum and value 0 is not be consider. If some switches have same priority, then the MAC address will be considered. Lower the MAC address is higher the Bridge ID. 

Scene 1
In every 2 seconds, every switch send a packet named BPDU ( Bridge Protocol Datagram Unit ) which includes details about bridge ID and etc. By BPDU's every switch came to know about all other switch's Bridge IDs and they automatically appointed a leader switch which have the highest Bridge ID ( Highest priority and lowest MAC ). The leader is named as Root bridge.

Scene 2
After appointing a root bridge the switches mark their ports as following
1. Root port - Outgoing port towards the root bridge
2. Designated port - Other ports in the loop except Root port

Scene 3
Calculate the costs of paths as follows
                    old      new
10Gbps                   2
01Gbps        1         4
100Mbps     10       19
10Mbps       100     100

After that the STP blocks the designated port at the port where the highest cost path to the root bridge. Then the loop will no available any more. Remember that the BPDU's can go through blocked port while other packets can't. 

Scene 3 
let's see what will happen when a link to the root port is went down. Remember that the STP can keep a port on 4 modes as follows
1. blocking
2. listening
3. learning
4. forwarding

When a link to the root bridge is down the blocked port have to come up for the proper functioning of the network. Bringing a port to the forwarding mode happen as follows

step 1. when a link is down the switch will not receive anymore BPDU's from that side. In certain cases a switch may miss some BPDUs. because of that switch stay for 20 seconds ( 10 BPDU ) to exactly know whether the link is down. If no any BPDU received from that side for 20 seconds, then the switch know exactly there's a problem.

step 2. After 20 seconds the port will be changed the status in to listening mode. in listening mode, the switch send BPDU's through the blocked port and listen do they come back from the other side. That's to make sure that there will not occur any loops if the blocked port is opened. The port keep on listening mode for 15 seconds and then go to the next step if there's no BPDU receiving from the other side.

step 3. Then the port will change the status to learning mode where the switch learns MAC addresses of network. Stay another 15 seconds on learning mode

step 4. The port will be opened for packets and start forwarding.

like that in STP it takes minimum of 50 seconds to network bring back to functioning. It is a big disadvantage taking so much time to bring the network up and working. All of the above described mode changing activities can be observe in a real switched network or by using Packet tracer with some techniques. For packet tracer users, I can send a simulation file on your request. please leave a comment or send a message via facebook if you need those simulation files.

Tuesday, March 16, 2010

Spanning Tree Protocol - 802.1d

Overview and introduction to Spanning tree protocol
STP is a standard protocol which is works on any brand of switches. ISL ( Inter Switch Link ) is the Cisco proprietary protocol instead of STP. STP cannot be explained alone since it's related with several number of operations on switches such as Bridge ID, BPDU and etc.


Spanning-Tree Protocol (STP) as defined in the IEEE 802.1D is a link management protocol that provides path redundancy while preventing undesirable loops in the network. For an Ethernet network to function properly, only one active path can exist between two stations. Loops occur in networks for a variety of reasons. The most common reason you find loops in networks is the result of a deliberate attempt to provide redundancy - in case one link or switch fails, another link or switch can take over.

STP is a technology that allows bridges to communicate with each other to discover physical loops in the network. The protocol then specifies an algorithm that bridges can use to create a loop-free logical topology. In other words, STP creates a tree structure of loop-free leaves and branches that spans the entire Layer 2 network.

Spanning-Tree Protocol operation is transparent to end stations, which are unaware whether they are connected to a single LAN segment or a switched LAN of multiple segments. Where two bridges are used to interconnect the same two computer network segments, spanning tree is a protocol that allows the bridges to exchange information so that only one of them will handle a given message that is being sent between two computers within the network.

Bridge Protocol Data Units (BPDUs) is used by bridges in a network to exchange information regarding their status. The Spanning-Tree Protocol uses the BPDU information to elect the root switch and root port for the switched network, as well as the root port and designated port for each switched segment.

The program in each bridge that allows it to determine how to use the protocol is known as the spanning tree algorithm, which is specifically constructed to avoid bridge loops. The algorithm is responsible for a bridge using only the most efficient path when faced with multiple paths. If the best path fails, the algorithm recalculates the network and finds the next best route. 
The spanning tree algorithm determines the network (which computer hosts are in which segment) and this data is exchanged using Bridge Protocol Data Units (BPDUs). It is broken down into two steps:

Step 1: The algorithm determines the best message a bridge can send by evaluating the configuration messages it has received and choosing the best option.


Step 2: Once it selects the top message for a particular bridge to send, it compares its choice with possible configuration messages from the non-root-connections it has. If the best option from step 1 isn't better than what it receives from the non-root-connections, it will prune that port. 
Related Posts with Thumbnails