You are on page 1of 42

Spanning Tree Protocol

Overview
Define redundancy and its importance in networking
Define broadcast storms and describe their impact on
switched networks
Define multiple frame transmissions and describe their
impact on switched networks
Identify the benefits and risks of a redundant topology
Describe the role of spanning tree in a redundant-path
switched network
Identify the key elements of spanning tree operation
List the spanning-tree states in order
Describe the process for root bridge, root port and
designated port elections.

2
Redundancy

Achieving such a goal requires extremely reliable networks.


Reliability in networks is achieved by reliable equipment
and by designing networks that accept failures and faults.
The network is designed to recover the fault quickly so that
the fault is bypassed.
Fault recovery is achieved by redundancy.

3
Redundant topologies

One Bridge Redundant Bridges

A network of roads is a global example of a


redundant topology.
If one road is closed for repair there is likely
an alternate route to the destination
4
Types of Traffic

Unknown Unicast

Types of traffic (Layer 2)


Known Unicast: Destination addresses are in Switch
Tables
Unknown Unicast: Destination addresses are not in
Switch Tables
Multicast: Traffic sent to a group of addresses
Broadcast: Traffic forwarded out all interfaces except
incoming interface. 5
Redundant switched
topologies

Remember: Switches use the Source MAC address to learn where the
devices are, and enters this information into their MAC address
tables.
Switches will flood frames for unknown destinations until they learn the
MAC addresses of the devices.
Broadcasts and multicasts are also flooded.
A redundant switched topology may (When STP is disabled) cause
broadcast storms, multiple frame copies, and MAC address table
instability problems.
6
Broadcast Storm

Broadcasts and multicasts can cause problems in a switched


network.
If Host X sends a broadcast, like an ARP request for the Layer 2
address of the router, then Switch A will forward the broadcast out
all ports.
Switch B, being on the same segment, also forwards all broadcasts.
Switch A sees the broadcasts and forwards them.
Switch B sees the broadcasts and forwards them.
The switches continue to propagate broadcast traffic over and over.
This is called a broadcast storm.
7
Multiple frame
transmissions
1
1 3

Host X sends a unicast frame to Router Y.


The router receives the frame because it is on the same segment as Host X.
Switch A does not have the MAC address of the Router Y and will therefore
flood the frame out its ports. (Segment 2)
Switch B also does not know which port Router Y is on.
Note: Switch B will forward the unicast onto Segment 2, creating multiple
frames on that segment.
After Switch B receives the frame from Switch A , it then floods the frame
that it has received causing Router Y to receive multiple copies of the same
frame.
This is a causes of unnecessary processing in all devices.
8
Media Access Control Database
Instability

In a redundant switched network it is possible for


switches to learn the wrong information.
A switch can incorrectly learn that a MAC address is on one
port, when it is actually on a different port.
Host X sends a frame directed to Router Y.
Switches A and B learn the MAC address of Host X on port 0.
The frame to Router Y is flooded on port 1 of both switches.
Switches A and B see this information on port 1 and
incorrectly learn the MAC address of Host X on port 1.
9
Spanning Tree Protocol

Redundant Paths and No Spanning Tree. So, whats


the problem?
10BaseT Ports (12) 100BaseT Ports

Moe

A
Host Kahn
0 0 -9 0 -2 7 -7 6 -9 6 -9 3
Hub
A
10BaseT Ports (12)

Larry
100BaseT Ports
Host Baran
0 0 -9 0 -2 7 -7 6 -5 D -F E
Host Kahn sends an Ethernet frame to Host Baran. Both
Switch Moe and Switch Larry see the frame and record
Host Kahns Mac Address in their switching tables.

10BaseT Ports (12) 100BaseT Ports

Moe

A
Host Kahn
0 0 -9 0 -2 7 -7 6 -9 6 -9 3
Hub
A
10BaseT Ports (12)

Larry
100BaseT Ports
Host Baran
0 0 -9 0 -2 7 -7 6 -5 D -F E
Both Switches do not have the destination MAC
address in their table so they flood it out all ports.
SAT (Source Address Table)
Port 1: 00-90-27-76-96-93
1 10BaseT Ports (12)

Moe

A
Host Kahn
Hub 00-90-27-76-96-93

A
10BaseT Ports (12)

Larry
1 2 100BaseT Ports
Host Baran SAT (Source Address Table)
Port 1: 00-90-27-76-96-93

00-90-27-76-5D-FE
Switch Moe now learns, incorrectly, that the
Source Address 00-90-27-76-96-93 is on Port A.

SAT (Source Address Table)


Port 1: 00-90-27-76-96-93

1 10BaseT Ports (12) Port A: 00-90-27-76-96-93

Moe

Host Kahn A
Hub 00-90-27-76-96-93

10BaseT Ports (12) A

Larry
100BaseT Ports
1 2 Host Baran
SAT (Source Address Table)
Port 1: 00-90-27-76-96-93

00-90-27-76-5D-FE
Switch Larry also learns, incorrectly, that the
Source Address 00-90-27-76-96-93 is on Port A.

SAT (Source Address Table)


Port 1: 00-90-27-76-96-93

1 10BaseT Ports (12) Port A: 00-90-27-76-96-93

Moe
Host Kahn A

Hub 00-90-27-76-96-93

10BaseT Ports (12) A


Larry
100BaseT Ports
1 2 Host Baran
SAT (Source Address Table)
Port 1: 00-90-27-76-96-93
00-90-27-76-5D-FE Port A: 00-90-27-76-96-93
Now, when Host Baran sends a frame to Host Kahn, it
will be sent the longer way, through Switch Larrys port A
and you may also see other unexpected results.
But what about broadcast frames, like ARP Requests?

SAT (Source Address Table)

1 10BaseT Ports (12) Port A: 00-90-27-76-96-93

Moe

Host Kahn A
Hub 00-90-27-76-96-93

10BaseT Ports (12) A

Larry
100BaseT Ports
1 2 Host Baran SAT (Source Address Table)
Port A: 00-90-27-76-96-93

00-90-27-76-5D-FE
Let us leave the switching tables alone and just
look at what happens with the frames. Host Kahn
sends out a Layer 2 broadcast frame, like an ARP
Request.
1 10BaseT Ports (12)

Moe

Host Kahn A
Hub 00-90-27-76-96-93

10BaseT Ports (12) A

Larry
100BaseT Ports
1 2
Host Baran

00-90-27-76-5D-FE
Because it is a Layer 2 broadcast frame, both
switches, Moe and Larry, flood the frame out all
ports, including their port As.

1 10BaseT Ports (12)

Moe

Host Kahn A
Hub 00-90-27-76-96-93

10BaseT Ports (12) A

Larry
100BaseT Ports
1 2
Host Baran

00-90-27-76-5D-FE
Both switches receive the same broadcast, but on
a different port. Doing what switches do, both
switches flood the duplicate broadcast frame out
their other ports.
1 10BaseT Ports (12)

Moe
Duplicate
frame
Host Kahn A
Duplicate
frame
Hub 00-90-27-76-96-93

10BaseT Ports (12) A

Larry
100BaseT Ports
1 2
Host Baran

00-90-27-76-5D-FE
Here we go again, with the switches flooding the
same broadcast again out its other ports. This
results in duplicate frames, known as a broadcast
storm!
10BaseT Ports (12)

Moe
ADuplicate
Host Kahn Frame

Hub 00-90-27-76-96-93 Duplicate


Frame

10BaseT Ports (12) A

Larry
100BaseT Ports
1 2
Host Baran

00-90-27-76-5D-FE
Remember, that Layer 2 broadcasts not only take
up network bandwidth, but must be processed by
each host. This can severely impact a network, to
the point of making it unusable.

10BaseT Ports (12)

Moe
A
Host Kahn
Hub 00-90-27-76-96-93

10BaseT Ports (12) A

Larry
1 2
Host Baran

00-90-27-76-5D-FE
Spanning Tree to Rescue!
Introducing Spanning-Tree Protocol

r ame
cast F
ad
B ro

Standby Link

Switches forward broadcast frames


Prevents loops
Loops can cause broadcast storms
Allows redundant links
Main function of the Spanning Tree Protocol (STP) is to
allow redundant switched/bridged paths without suffering
the effects of loops in the network
Understanding STP States

Blocking - No frames forwarded, BPDUs


(Bridge Protocol Data Units) heard
Listening - No frames forwarded,
listening for frames
Learning - No frames forwarded,
learning addresses
Forwarding - Frames forwarded,
learning addresses
Disabled - No frames forwarded, no
BPDUs heard
Spanning Tree Process

Step 1: Electing a Root Bridge


Step 2: Electing Root Ports
Step 3: Electing Designated Ports
All switches send out Configuration Bridge
Protocol Data Units (Configuration BPDUs)
BPDUs are sent out all interfaces every two
seconds (by default)
All ports are in Blocking Mode during the
initial Spanning Tree is process.
Example:
3 Switches with redundant paths, Can you find them?

Moe 1 AB

10BaseT Ports (12) 100BaseT


Ports
Larry AB

10BaseT Ports (24) 100BaseT


Ports
Curly AB
1

10BaseT Ports (24) 100BaseT


Ports
Three Steps to Spanning Tree Process
Step 1: Electing a Root Bridge
Bridge Priority
Bridge ID
Root Bridge
Step 2: Electing Root Ports
Path Cost or Port Cost
Root Path Cost
Root Port
Step 3: Electing Designated Ports
Path Cost or Port Cost
Root Path Cost
Step 1: Electing a Root Bridge
The first step is for switches to select
a Root Bridge.
The root bridge is the bridge from
which all other paths are decided.
Only one switch can be the root
bridge.
Election of a root bridge is decided
by:
1. Lowest Bridge Priority
2. Lowest Bridge ID (tie-breaker)
Bridge Priority
This is a numerical value.
The switch with the lowest bridge priority is
the root bridge.
The switches use BPDUs to accomplish this.
All switches consider themselves as the root
bridge until they find out otherwise.
All Cisco Catalyst switches have the default
Bridge priority of 32768.
If multiple switches have the same priority
number, then a bridge ID will be used to
break the tie.
Bridge ID
The Bridge ID is the MAC address
assigned to the individual switch.
The lower Bridge ID (MAC address) is
the tiebreaker.
Because MAC addresses are unique,
this ensures that only one bridge will
have the lowest value.
Bridge Priorities and Bridge Ids
Which one is the lowest?

Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT


Ports
Larry Priority: 32768 ID: 00-B0-64-58-CB-80 AB

10BaseT Ports (24) 100BaseT


Ports
Curly Priority: 32768 ID: 00-B0-64-58-DC-00 AB
1

10BaseT Ports (24)


You got it!

Lowest: Moe becomes the root bridge

Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT


Ports
Larry Priority: 32768 ID: 00-B0-64-58-CB-80 AB

10BaseT Ports (24)

Curly Priority: 32768 ID: 00-B0-64-58-DC-00


1

10BaseT Ports (24) AB


Step 2: Electing Root Ports
After the root bridge is selected,
switches (bridges) must locate
redundant paths to the root bridge and
block all but one of these paths.
The switches use BPDUs to
accomplish this.
How does the switch make the
decision on which port to use, known
as the root port, and which one should
be blocked?
Redundant Paths

Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT Ports

Larry Priority: 32768 ID: 00-B0-64-58-CB-80


AB

10BaseT Ports (24) ? ?


100BaseT Ports
Curly Priority: 32768 ID: 00-B0-64-58-DC-00
1 ?

10BaseT Ports (24) 100BaseT Ports


? AB
Path Cost (or Port Cost):
Port Cost is used to help find the cheapest
or fastest path to the root bridge.
By default, port cost is usually based on the
medium or bandwidth of the port.
On Cisco Catalyst switches, this value is
derived by dividing 1000 by the speed of the
media in megabits per second.
Examples:
Standard Ethernet: 1,000/10 = 100
Fast Ethernet: 1,000/100 = 10
Root Path Cost
The root path cost is the cumulative
port costs (path costs) to the Root
Bridge.

Root Ports
Ports directly connected to the root
bridge will be the root ports.
Otherwise, the port with the lowest
root path cost will be the root port.
Path Costs

Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT Ports

Larry Priority: 32768 ID: 00-B0-64-58-CB-80 AB

10BaseT Ports (24) 10 10


100BaseT Ports
Curly Priority: 32768 ID: 00-B0-64-58-DC-00
1 10

10BaseT Ports (24) 100BaseT Ports


100 AB
Curly:
Even though the Path Cost to the root bridge for Curly is
higher using Port 1, Port 1 has a direct connection to
the root bridge, thus it becomes the root port.
Port 1 is then put in Forwarding mode, while the
redundant path of Port A, is put into Blocking mode.
Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT Ports

Larry Priority: 32768 ID: 00-B0-64-58-CB-80


AB

10BaseT Ports (24) 100BaseT Ports


Curly Priority: 32768 ID: 00-B0-64-58-DC-00 A= Blocking
1

Forwarding 10BaseT Ports (24) 100BaseT Ports


AB
Larry:
Larry also has a root port, a direct connection with the
root bridge, through Port B.
Port B is then put in Forwarding mode, while the
redundant path of Port A, is put into Blocking mode.

Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT Ports

Larry Priority: 32768 ID: 00-B0-64-58-CB-80 B=Forwarding


AB

10BaseT Ports (24) 100BaseT Ports


A= Blocking
Curly Priority: 32768 ID: 00-B0-64-58-DC-00 A= Blocking
1

Forwarding 10BaseT Ports (24) 100BaseT Ports


AB
Root Ports

Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT Ports

Larry Priority: 32768 ID: 00-B0-64-58-CB-80 Root Port


AB

10BaseT Ports (24) 100BaseT Ports


A= Blocking
Curly Priority: 32768 ID: 00-B0-64-58-DC-00
1 A= Blocking

Root Port 10BaseT Ports (24) 100BaseT Ports


AB
Step 3: Electing Designated Ports
The single port for a switch that sends and
receives traffic to and from the Root Bridge.
It can also be thought of as the port that is
advertising the lowest cost to the Root Bridge.
In our example, we only have the two obvious
choices, which are on switch Moe.
Designated Ports

Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

Designated Port 10BaseT Ports (12) Designated Port

Larry Priority: 32768 ID: 00-B0-64-58-CB-80 Forwarding


AB

10BaseT Ports (24) 100BaseT Ports


A= Blocking
Curly Priority: 32768 ID: 00-B0-64-58-DC-00
1 A= Blocking

Forwarding 10BaseT Ports (24) 100BaseT Ports


AB
Spanning Tree Completed
Spanning Tree is now complete, and the switches
can begin to properly switch frames out the proper
ports with the correct switching tables and without
creating duplicate frames.
Moe 1 Priority: 32768 ID: 00-B0-64-26-6D-00 AB

10BaseT Ports (12) 100BaseT Ports

Larry Priority: 32768 ID: 00-B0-64-58-CB-80 Forwarding


AB

10BaseT Ports (24) 100BaseT Ports


X Blocking
Curly Priority: 32768 ID: 00-B0-64-58-DC-00 X Blocking
1

Forwarding 10BaseT Ports (24) 100BaseT Ports


AB

You might also like