Thursday, June 18, 2015

Spanning Tree Protocol | Configure on Cisco Switch

Typically every network infrastructure has redundant path for better communication among the network, but there may be loops over the redundant paths. So STP(Spanning Tree Protocol) ensure loop-free network topology in the entire network and this helps to avoid the unwanted traffic over the network. To overcome this issue we STP can be used, before that Root Bridge should be selected in the network topology.


In root bridge selection, there are some facts need to consider. I will explain about this using the below example with that network diagram.

 

When Root bridge is selected other connected ports of switches are classified, those are described below.

  1. Root Port : Best port reach to the Root Bridge
  2. Designated Port : Other end of the root port connecting to the other switches.
  3. Non - Designated Port : This is the redundant port and it is blocked.

In Root Bridge selection, it is done with an election process by considering some facts. In a network topology every switches has Bridge ID (BID) which contains priority value(Default Value : 32769). When the every switches in the network boots up, they send BPDU(Bridge Protocol Data Unit) packets including BID and the Root ID to the entire network. Just after the booting up, every switches identifies then as Root Bridge itself. After that everyone sends out the BPDUs to the neighbouring switches and reads Root ID of everyone, then decide the Root Bridge. Root Bridge will be the switch which contains lowest BID value. So that switch will be the Root Bridge.

In my example, I’ll show the the spanning-tree details in each switches.

Switch0#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             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     000C.CFC2.CDEA
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/4            Desg FWD 19        128.4    P2p
Fa0/6            Desg FWD 19        128.6    P2p
Fa0/7            Desg FWD 19        128.7    P2p
Fa0/5            Desg FWD 19        128.5    P2p
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/2            Desg FWD 19        128.2    P2p
Fa0/3            Desg FWD 19        128.3    P2p
Fa0/8            Desg FWD 19        128.8    P2p


Switch1#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             Cost        19
             Port        1(FastEthernet0/1)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    40961  (priority 40960 sys-id-ext 1)
             Address     00D0.97DE.DEEE
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/6            Altn BLK 19        128.6    P2p
Fa0/3            Altn BLK 19        128.3    P2p
Fa0/4            Altn BLK 19        128.4    P2p
Fa0/7            Desg FWD 19        128.7    P2p
Fa0/8            Desg FWD 19        128.8    P2p
Fa0/1            Root FWD 19        128.1    P2p
Fa0/2            Altn BLK 19        128.2    P2p
Fa0/5            Altn BLK 19        128.5    P2p


Switch2#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             Cost        19
             Port        1(FastEthernet0/1)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    40961  (priority 40960 sys-id-ext 1)
             Address     0001.6338.8C20
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/8            Desg FWD 19        128.8    P2p
Fa0/6            Desg FWD 19        128.6    P2p
Fa0/3            Desg FWD 19        128.3    P2p
Fa0/4            Desg FWD 19        128.4    P2p
Fa0/5            Desg FWD 19        128.5    P2p
Fa0/1            Root FWD 19        128.1    P2p
Fa0/2            Altn BLK 19        128.2    P2p
Fa0/7            Desg FWD 19        128.7    P2p


Switch3#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             Cost        19
             Port        5(FastEthernet0/5)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    40961  (priority 40960 sys-id-ext 1)
             Address     0001.6399.2891
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/8            Desg FWD 19        128.8    P2p
Fa0/2            Desg FWD 19        128.2    P2p
Fa0/4            Altn BLK 19        128.4    P2p
Fa0/6            Altn BLK 19        128.6    P2p
Fa0/5            Root FWD 19        128.5    P2p
Fa0/7            Desg FWD 19        128.7    P2p
Fa0/3            Altn BLK 19        128.3    P2p

According to the results you can see the Bridge ID in Switch1, Switch2, Switch3 are same with 40961, but the  Switch0 has value 32769. 

                                                                            40961 > 32769
               Switch1, Switch2, Switch3 > Switch0

Therefor the Switch0 will be elected as Root Bridge. But if You want to change the root bridge you can change it by changing the BID.

Switch(config)#spanning-tree vlan 1 priority <value>
<value> : <0-61440>  bridge priority in increments of 4096




Thank You ... :)

No comments:

Post a Comment