Wednesday, June 19, 2013

Spanning Tree




Elements

Our network above consists of 4 switches
We will investigate spanning tree election and will try to modify its parameters to influence the selection

Configuration

SW1, SW2, SW3, SW4

conf t
vlan 10

We will configure all the links to be access ports in vlan 10 created above

conf t
int f1/1
switchport mode access
switchport access vlan 10
speed 100
duplex full




Verification

Now let us check what the result of the selection process is as we left all values to its default
 
SW1#show spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c201.3602.0001
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    32768
             Address     c201.3602.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD     0 32768 c201.3602.0001 128.42 
FastEthernet1/2      128.43   128    19 FWD     0 32768 c201.3602.0001 128.43
 
As can be seen, SW1 elects itself as the root bridge, why? Because the priority value on all switches are left to default (32768) which leave the MAC address to handle the process , as SW1 appears to be the root bridge that means it has the lowest MAC address and as we can see all of its ports are in FWD state
 
SW2#sh spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c201.3602.0001
             Cost        19
             Port        42 (FastEthernet1/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    32768
             Address     c202.3602.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD     0 32768 c201.3602.0001 128.42 
FastEthernet1/2      128.43   128    19 FWD    19 32768 c202.3602.0001 128.43 
FastEthernet1/4      128.45   128    19 FWD    19 32768 c202.3602.0001 128.45
 
SW3#sh spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c201.3602.0001
             Cost        19
             Port        42 (FastEthernet1/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    32768
             Address     c203.3602.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD     0 32768 c201.3602.0001 128.43 
FastEthernet1/2      128.43   128    19 BLK    19 32768 c202.3602.0001 128.43
 
R4#sh spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     c201.3602.0001
             Cost        38
             Port        45 (FastEthernet1/4)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    32768
             Address     c204.3602.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/4      128.45   128    19 FWD    19 32768 c202.3602.0001 128.45
 
As can be seen from the output above, R3 is the least preferred switch to be elected as the root bridge which can be confirmed from the BLK status of its F1/2 interface which was chosen to be blocked because it has higher priority than F1/1 interface (128.43), R4 has a higher MAC address but it’s not part of the loop 
 
Now, what we want to do is to make SW4 the root bridge, we have two commands that we can configure to do that:
spanning-tree vlan 10 priority <0-65535> (we can choose any value less than 32768 in decrements of 4096)
spanning-tree vlan 10 root primary (which automatically will give the switch a value of 24576 which is less than the default and will be preferred to be the root bridge)
 
SW4
 
conf t
spanning-tree vlan 10 root primary 
 VLAN 10 bridge priority set to 8192
 VLAN 10 bridge max aging time unchanged at 20
 VLAN 10 bridge hello time unchanged at 2
 VLAN 10 bridge forward delay unchanged at 15
 
Now, let us check the outputs again
 
SW1#sh spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     c204.3602.0000
             Cost        38
             Port        42 (FastEthernet1/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    32768
             Address     c201.3602.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD    19 32768 c202.3602.0001 128.42 
FastEthernet1/2      128.43   128    19 FWD    38 32768 c201.3602.0001 128.43
 
As can be seen SW1 is no longer the root bridge . c204 represents SW4
 
SW2#sh spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     c204.3602.0000
             Cost        19
             Port        45 (FastEthernet1/4)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    32768
             Address     c202.3602.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD    19 32768 c202.3602.0001 128.42 
FastEthernet1/2      128.43   128    19 FWD    19 32768 c202.3602.0001 128.43 
FastEthernet1/4      128.45   128    19 FWD     0  8192 c204.3602.0000 128.45
 
SW3#sh spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     c204.3602.0000
             Cost        38
             Port        43 (FastEthernet1/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    32768
             Address     c203.3602.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 BLK    38 32768 c201.3602.0001 128.43 
FastEthernet1/2      128.43   128    19 FWD    19 32768 c202.3602.0001 128.43
 
SW4#sh spanning-tree vlan 10 brief 
 
VLAN10
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     c204.3602.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
 
  Bridge ID  Priority    8192
             Address     c204.3602.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
 
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/4      128.45   128    19 FWD     0  8192 c204.3602.0000 128.45
 
What we can notice is that SW3 F1/1 is now blocked, why? because the factor that precede the port priority is the path cost to the root bridge , F1/1 cost is 38 (default value for FastEthernet connection is 19 , which means two links) , F1/2 cost is 19 which means it’s preferred and its role will be root port and F1/2 will be in BLK state