Popular Posts

Share |

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.

No comments:

Post a Comment

Related Posts with Thumbnails