Monday 12 December 2016

Spanning Tree Interview Q & A


For a quick recap refer to below links/Video:


Purpose of the Topology Change Mechanism
1. What is Spanning tree ??

Spanning-tree protocol is a protocol used in switching network to create a loop-free topology. STP is enabled by default on all VLANs on Catalyst switches. STP switches send BPDU’s (Bridge Protocol Data Units) to each other to form their topology databases. BPDU’s are sent out all ports every two seconds, are forwarded to a specific MAC multicast address: 0180.c200.0000.

2.What causes a loop in a switched network?

When two switches connected via a single cable there will be no loops in switching network. Below topology is a example.

Loops occur when we add redundancy to avoid single point failure(means connecting two switches via two or more cable to give back up in the case of a failure to one of the link).When a loop is introduced into the network, a highly destructive broadcast storm can develop within seconds and it will slow down or block off all other traffic.

Lets see how loop happening in below topology



1.      Computer A which is connected to switch A sends an ARP request because it’s looking for the MAC address of a computer connected to switch B. An ARP request is a broadcast frame. 
2.     Switch A will forward this broadcast frame on all it interfaces, except the link where the frame originated from. 
3.     Switch B will receive both broadcast frames from switch A
4.     Switch B will forward it out of every link except the interface where it originated from. 
5.     This means that the frame that was received on Interface fa0/1 will be forwarded on Interface fa0/2. 
6.     The frame that was received on Interface fa0/2 will be forwarded on Interface fa0/1.

So a loop will occur in the network.Both switches will keep forwarding over and over until we disconnect one of the cable or switch might crash due to overburden traffic.

3.How STP block or prevent loop ?

STP enabled switch will block port if a loop exist and blocked port will be activated again if needed.Check below topology.


4.What are the different port states?
1.Disabled -  A port in the disabled state does not participate in the STP.

2.Blocking - A blocked port does not forward frames. It only listens to BPDUs. 
                           The purpose of the blocking state is to prevent the use of looped paths.

3.Listening - A port in listening state prepares to forward data frames without populating                               the MAC address table. The port also sends and listens to BPDUs to make                                   sure no loops occur on the network.

4.Learning - A port in learning state populates the MAC address table but doesn’t forward                              data frames. The port still sends and receives BPDUs as before.
5.Forwarding -The port now can send and receive data frames, collect MAC addresses in                                   its address table,send and receive BPDUs. The port is now a fully                                                   functioning switch port within the spanning-tree topology.

5.Explain types of STP Port Roles?
Root port - The root port is always the link directly connected to the root bridge, or the shortest path to the root bridge. It is always on Non-Root Bridge.

Designated port - A designated port is one that has been determined as having the best (lowest) cost. A designated port will be marked as a forwarding port. It can be on both Root 
Bridge & Non Root Bridge. All ports of Root Bridge are Designated Port.

Forwarding port - A forwarding port forwards frames.

Blocked port - A blocked port is the port that is used to prevent loops. It only listens to BPDUs. Any port other than Root port & Designated port is a Block Port.


For More Detail on BPDU refer to the below blog:

6.What is BPDU?
Switches running spanning-tree, exchange information with a special message called the (BPDU) bridge protocol data unit. BPDU is a data message transmitted across a local area network to detect loops in network topologies. A BPDU contains information regarding ports, switches, port priority and addresses.


BPDU can be called as the language of switch. BPDU’s are sent out all ports every two 

seconds, are forwarded to a specific MAC multicast address: 0180.c200.0000.

When a switch is "UP" it starts sending BPDU through every ports.If a BPDU comes back to the switch,switch will know there is a redundant  link.In such cases switch will run STP.


There are two types of BPDU


·        Configuration BPDU
·        TCN BPDU (Topology change notification)

When devices are initially attached to switch ports, they do not start data transmission immediately. Instead, they moves through different states while BPDU processing determines the network topology. A topology change notification (TCN) BPDU informs other switches of port changes. They are injected into the network by a non-root switch and propagated to the root. When a TCN is received, the root switch will set a topology change flag in its normal BPDU. This flag is propagated to all other switches to instruct them to rapidly age out their forwarding table entry switches.

When a root receives the TCN BPDU, it transmits a configuration BPDU message on all the ports with topology change flag set to 1. Switches that receive this BPDU on the root port filter the database and generate their own configuration BPDUs on designated ports. This propagates down the tree to the end of the path. 
 


7.What is the destination MAC address used by Bridge Protocol Data Units (BPDUs)?

Bridge Protocol Data Units (BPDUs) frames are sent out as at multicast destination 

MAC address  01:80:c2:00:00:00.


Refrer to the Below example with a big topology:

Example:

  
For simplicity the MAC of switches is taken as below

MAC of Switch A : AAA
MAC of Switch B : BBB
MAC of Switch C : CCC

Identifying Root bridge
In the above example priority of all switches are default (32768).So we have to look at the lowest MAC address to find the root bridge.Switch A having the lowest Mac address among all and elected as Root Bridge.We know all ports of Root bridge will be designated ports(Forwarding state) and represented by D

Identifying Root Ports
Fa 0/14 of switch B and Fa 0/14 of switch C are the Root port here because they are the shortest path to reach Root Bridge.

Identifying the designated ports
Now we have to find which port have to designated and which port have to be blocked between Switch B and Switch C.As we know the switch having lowest MAC Address will be the designated port here and other switch will be in blocked state.Here Switch B has lowest MAC address than Switch C.So Fa 0/16 of switch B become designated port and Fa 0/16 of switch C will be alternative port(Blocked Port)

To remember:

·        STP is also called IEEE 802.1D
·        STP is used to avoid loops
·        Ethernet has no capacity for detecting loops.If a loop exist,broadcast storm will appear
·        STP prevents loop formation by detecting redundant links and disabling them until needed.
·        STP is enabled by default in switches
·        STP works by selecting a switch in the network as a root bridge
·        A STP network must select
o   One root bridge
o   One root port per non-root bridge
o   One designated port per network segment
·        Designated port (DP) : All ports in root bridge must be DP.All designated ports will be in forwarding state
·        Root Port (RP) : Root port is the port in the non-root bridge that connects the best path to root bridge
·        Blocked port (BP) : Such ports will be in blocked state.it will receive informations from Designated ports but will not send any information through it
·        One end of every link must be designated port.Other end may be Blocked Port OR Root Port


Why rstp is faster than stp??

1. RSTP uses proposal / Agreement instead of STP using timers.
2. All the STP tool kit (uplink fast, backbone fast, etc) are included in RSTP by default.
3. RSTP have simplified port roles.

4. The way BPDU's are flown / the way RSTP handles the topology change is quite different from STP.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.