Monday, 24 February 2020

Switch working-5: All about Spanning Tree-Protocol

In This section we will try to answer the following questions


  • What is STP?
  • What are the features of STP?
  • What is the need of STP?
  • How STP avoid loop in network?
  • What is switching loop?
  • What is redundancy in Network ?
  • Why switching table get inconsistent without STP?
  • What is Bridge ID and Root ID?
  • How a switch is selected as a Root Bridge in network?

  • As we knows that nowadays a series of switches are used in any network if we take a linear network in which all switches are connected in a series fashion and pc0 communicate with pc1 as shown  below, then if any link or device fails, the communication will stop,
    so there must be more then one path to reach the destination to avoid single point failure, if a network have more then one path to reach the destination is called a Redundant path, redundant path are useful and necessary for any network to avoid  the latency and single point failure. So having a redundant path may overcome the single point failure but could arise some more problems,
    as shown in diagram we have 4 switches Switch 0, switch 1 switch 2, and switch 3 . so in this case if switch 0 sends information to switch 3 and any of the one link or device fails in the middle, the packet will still reach at destination because of redundant path. but redundant path in network could cause serious problem 
    Redundant path may cause 
    • Switching loop 
    • Inconsistent switching tables
    • unnecessary bandwidth utilization
    • Broadcast storms
    • Multiple frame transmission
    1. Switching loop is a serious problem in network in which packet instead of delivered at destination remain forwarded between two or three nodes and never reach to destination.
    2. suppose pc0 trying to ping pc1 then at the packet reach at switch 0 , 
      1. the switch maintain the information that pc0 is connected from port fa 0/3 and broadcast the packet at rest two port i.e fa 0/1 and fa0/2. 
      2. now switch 1 receive two packet having information about pc0 one come from switch 0 which is connected to port fa 0/1 of switch 1 and  one from switch 2 which is connected to port fa 0/2 of switch 1 so switch 1 get confused that pc0 is either connected at port fa 0/1 or port fa0/2 and the same thing happen at switch2 and switch3 and each time each switch broadcast the frame in network which cause the broadcast storm and  unnecessary bandwidth utilization and also switching table got inconsistent about pc0
    To avoid all these problem IEEE 802.ID introduced

    Spanning Tree Protocol

    (STP) which is a Layer 2 protocol that runs on switches and bridges, If there is redundant paths in network, it make sure to maintain loops free network, enabling only single path in forwarding state and the rest remain in blocking state as a backup link or say If the active link fails, backup link take load of active link which provide fault tolerance
    As shown above packet from pc0 to pc1 would be forwarded from switch0 to switch 3 bia switch 1 and couldn't attend the alternate path due to blockage of port fa 0/2 of switch 0 and fa 0/1 at switch 2 so loop couldn't be formed and the packet would be delivered to pc1

    Features of STP

    • IT is an open standard protocol defined by IEEE 802.ID
    • RSTP defined by IEEE 802.1w
    • It is enabled by default in all cisco catalyst switches
    • Enable single link to forwarding and rest in blocking stage by disabling  port.
    • Blocking link automatically  recover if active link fails.
    • It  avoid Broadcast Storm,
    • Avoid Database instability, 
    • Avoid switching loops and also
    • Avoid multiple copy of frames

    Port Status:-

    • Disable:Port is in Disable State
    • Blocking : Port is not in disable state but in blocking state to avoid loop in network
    • Listening : Initially exchanging there BPDU to become root Bridge
    • Learning : Decided there root port and Designated ports and blocking ports
    • Forwarding : Ready To forward Data

    How STP WORKS?

    working of STP is very simple and follow some method to enable single path at once. i.e :
    • Selecting Root Bridge
    • Selecting Root Port
    • Selecting Designated port & Non Designated ports.


    Fig mistake Designated is misspelled with Desinated 
    Root Bridge Out of all switches in the network selecting one switch as a central or master switch through which all traffic flows is called a Root Bridge
    Root port:- All the ports connecting to Root Bridge are called root Port
    Designated ports: The ports which forward the data are called Designated port
    Non Designated ports:- The ports which don't forward the data and remain in blocking stage are called as Non designated port, these ports get active if active link fails

    Now the big question is 

    How switch choose Root Bridge?

    Selection of Root Bridge Could as:-
    • Automatic Selection
    • Manual Selection
      • Directly Assigning switch as a Root Bridge
      • By decreasing the priority value

    Automatic Selection of Root Bridge:-

    •  Initially Each Switch declare themselves as a Root Bridge,
    •  Every Switch in the network exchange the BPDU (Bridge Protocol Data Unit ),
    •  BPDU  message shared in every 2 seconds,
    • As a switch receives a BPDU message, it compare it's Bridge ID, update themselves  and store the information about system with lowest Bridge id,
    • This process goes on until all the switches are satisfied with which switch have the lowest bridge I’d and
    • Switch with lowest Bridge ID declared as the Root Bridge,

    Priority , Root ID and Bridge ID of  Switch: Sw1, SW 2 and SW3
    Troubleshooting:
    As shown above Bridge id could be seen by giving command 
    SW1# show Spanning-tree
    VLAN0001
    Spanning tree enabled protocol ieee
              Root ID           Priority            32769
                                      Address           0002.1678.0C91
                                     This bridge is the root
              Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

              Bridge ID         Priority            32769 (priority 32768 sys-id-ext 1)
                                       Address           0002.1678.0C91
             Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20

    in this screen shot Root ID Value and Bridge ID Value is shown
    Root id is value of switch chosen as Root Bridge
    Bridge ID is value of switch  on which we are checking the details. in this case Root ID and Bridge ID is same.

    I know the new question arise in the mind What is Bridge ID? so  you just don't worry i will try to break the Question, you just click to know more about Bridge ID  for this section your just make a mind that Each Switch has a Bridge ID, and 

    Bridge ID= priority + extended system id followed by MAC Address.

    Manual Configuration of Root Switch

    Before configuring a switch as a root, try to know 

    Why we need To have a Configured Root Bridge?

    There are several reason to change Bridge Id, like 
    As we all know that the switch with lower Bridge id will become the root bridge,and the following reason , why to have a configured Root Bridge.
    • So any newer switch with lower bridge id will  become root bridge and all data start flowing through it, which could be on security risk.
    • Older switch with slower data transmission rate  could be a rood bridge result in slower network response/ slow data processing or flow rate(slower internet speed)
    •  Easy to monitoring and managing all data flow through managed switch.
    Root Bridge Configuration:-
    1. Changing priority Value
      • As we all know that switch with lower Bridge id become root bridge
      • Changing priority value would force a switch either to 
        • become root bridge , 
        • backup root bridge 
        • Never become a  root bridge by setting a higher priority.
    Before configuring priority value 

      Configuration:

      Points to Remember while configuring bridge priority value.
      • Priority would be in range of  0-61440  
      • It would be in multiple of  of 4096 i.e
        Allowed values are:
        0,  4096,  8192,  12288,  16384,  20480, 24576,  28672, 32768,  36864, 40960,  45056, 49152,  53248,  57344,  61440

        1. Switch>enable

          Switch#configure terminal
          Switch(config)#spanning-tree vlan 1 priority 0

        if we give this command the switch will become root bridge because it is the lowest priority value.

    setting priority value 0



      as show above even though the priority is configured 0, it's showing 1, which is the extended system ip (vlan no.) i.e Bridge ID = Priority + Ex. system ID


      2. Switch>enable
          Switch#configure terminal
           Switch(config)#spanning-tree vlan 1 priority 4096
        This is the second priority value and could be root bridge or secondary root bridge which would act on failure of primary root bridge.
            Setting Priority Value to 4096
              as could see root id's priority is 1 and bridge id's priority is 4096 ,so if no other switch are configured then this switch become root bridge if root bridge switch fails

              3.   Switch>enable
                    Switch#configure terminal
                    Switch(config)#spanning-tree vlan 1 priority 61440
                System with Highest Priority Value

                  This is the last priority value and the switch with this priority 61440 will never take a part in being root bridge,because it is the highest priority vlaue, which means if your want some switch to never become a root bridge , this priority could be assign.

                  4. Instead of giving a priority a system could be directly assign as primary root or secondary root by giving command"
                          Switch>enable
                          Switch#configure terminal
                          Switch(config)#spanning-tree vlan 1 root primary

                    so if the switch in not configured and all switch are set with default priority i.e 32768 the then this command will decrease the priority by 4096 and the system will become root.
                          Switch>enable
                          Switch#configure terminal
                          Switch(config)#spanning-tree vlan 1 root secondary

                    Summary : Root Bridge Selection process

                    By default Priority is 32768 and if there is tie among all switches, selection is made  on the basis of  
                    • Selection is made on the basis of Priority Value but if it is tie
                    • Selection made on the basis of Priority + MAC address
                    Note:-There is only one Root Bridge even though having 100 of switches in the network.
                    • Selection of Root Port:
                    Note:- for every non rood Bridge(switch) there is only 1 root port and all are designated port


                    Condition for Selecting Root Port
                        • Least path cost to Root Bridge
                        • Lowest Forwarding Bridge ID (priority + MAC)
                        • Lowest Forwarding Physical Port Address (Port No.)
                    Note:- The default path cost value for port is on the basis of there transmission speed. ie

                                    Bandwidth---- Port Cost
                    • for 10 mbps-----100
                    • for 100 mbps----19
                    • for 1 GB------------4
                    • for 10 GB----------2
                    As shown is fig why fa 0/3 is root port it is because switch 0 is root bride and since fa 0/3 is directly connected with root bridge so cost is 19 while if packet goes through switch 2 the cost will be 19+19= 38 and if least cost to reach root bridge is 19 so fa0/3 is root port

                    No comments:

                    Post a Comment

                    Networking Products:- Buy Directly from Amazon

                    ePackets

                    Your Words