Spanning Tree Protocol
Spanning Tree Protocol
How it works
● Spanning Tree is an industry standard protocol and is enabled by default on
all vendor’s switches
● Switches send Bridge Protocol Data Units out all ports when they come
online. These are used to detect other switches and potential loops
● The switch will not forward traffic out any port until it is certain it is loop free
● When the port first comes online it will be in a Blocking state.
● Spanning Tree will detect if the port forms a potential loop
● If there is no loop the port will transition to Forwarding
● The process can take up to 50 seconds
● The BPDU contains the switch’s Bridge ID which uniquely identifies the switch
on the LAN
● The Bridge ID is comprised of the switch’s unique MAC address and an
administrator defined Bridge Priority value
● The Bridge Priority can be from 0 – 65535, with 32768 being the default
● A Root Bridge is elected based on the switches’ Bridge ID values
● The switch with the lowest Bridge Priority value is preferred (16384 is better
than 49152)
● In the case of a tie the switch with the lowest MAC address will be selected
● The switches build a loop free forwarding path Tree leading back to the Root
Bridge
STP Configuration
Acc3#show spanning-tree vlan 1
● Vlan 10
R1(config)#interface g0/1.10
R1(config)#encap dot1 vlan 10
R1(config-if)#ip address 10.10.10.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#standby 1 ip 10.10.10.1
R1(config-if)#standby 1 priority 110
R1(config-if)#standby 1 pre-empt
R2(config)#interface g0/1.10
R2(config)#encap dot1 vlan 10
R2(config-if)#ip address 10.10.10.3 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#standby 1 ip 10.10.10.1
R2(config-if)#standby 1 priority 90
● Vlan 20
R1(config)#interface g0/1.20
R1(config)#encap dot1 vlan 20
R1(config-if)#ip address 10.10.20.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#standby 1 ip 10.10.20.1
R1(config-if)#standby 1 priority 90
R2(config)#interface g0/1.20
R2(config)#encap dot1 vlan 20
R2(config-if)#ip address 10.10.20.3 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#standby 1 ip 10.10.20.1
R2(config-if)#standby 1 priority 110
R2(config-if)#standby 1 pre-empt
● If you enable Portfast on a port and then a loop is formed through it, a
broadcast storm will result
● This can be caused by users adding devices to the network or changing
cabling
● You can enable BPDU Guard on Portfast ports to guard against this
happening
● If a BPDU is received the port will be shut down
SW1(config)# interface f0/10
SW1(config-if)# spanning-tree portfast
SW1(config-if)# spanning-tree bpduguard enable
SW1(config)# spanning-tree portfast bpduguard default
NIC Teaming
NIC Teaming combines multiple physical network cards into a single
logical interface
LACP
● LACP interfaces can be set as either Active or Passive
● If SW1’s interfaces are set as Active and SW2’s as Passive, the port channel
will come up
● If both sides are Passive, the port channel will not come up
● If both sides are Active, the port channel will come up
● It is recommended to configure both sides as Active so you don’t have to think
about which side is which
SW1(config)#interface range f0/23 - 24
SW1(config-if-range)#channel-group 1 mode active
This creates interface port-channel 1
SW1(config)#interface port-channel 1
SW1(config-if)#switchport mode trunk
Configure the interface settings on the port channel
Configure matching settings on the other switch on the other side of the links:
SW2(config)#interface range f0/23 - 24
SW2(config-if-range)#channel-group 1 mode active
SW2(config)#interface port-channel 1
SW2(config-if)#switchport mode trunk
PAgP Configuration
● PAgP interfaces can be set as either Desirable or Auto
● If one side is Desirable and the other Auto, the port channel will come up
● If both sides are Auto, the port channel will not come up
● If both sides are Desirable, the port channel will come up
● If you configure both sides as Desirable you don’t have to think about which
side is which
SW1(config)#interface range f0/23 - 24
SW1(config-if-range)#channel-group 1 mode desirable
SW1(config)#interface port-channel 1
SW1(config-if)#switchport mode trunk
Configure matching settings on the switch on the other side of the links
Static Configuration
SW1(config)#interface range f0/23 - 24
SW1(config-if-range)#channel-group 1 mode on
SW1(config)#interface port-channel 1
SW1(config-if)#switchport mode trunk
Configure matching settings on the switch on the other side of the links
Multi-chassis EtherChannel
Layer 3 Etherchannel
Switch1(config)#interface range GigabitEthernet 1/0/1 - 2
Switch1(config-if-range)#no switchport
Switch1(config-if-range)#channel-group 1 mode | active | auto
| desirable | on | passive
Switch1(config)#interface port-channel 1
Switch1(config-if)#ip address 192.168.0.1 255.255.255.252
Switch1(config-if)#no shutdown