Sie sind auf Seite 1von 48

ADMINISTRATION OF NETWORK

INFRASTRUCTURE:
SPANNING-TREE PROTOCOLS (STP)

The slides are modified from the course: Cisco CCNP SWITCH.
1
SPANNING TREE
PROTOCOLS (STP)

STP often accounts for more than 50 % of


the configuration, troubleshooting, and
maintenance headaches in real-world
campus networks (especially if they are
poorly designed).

2
SPANNING TREE PROTOCOL
(STP)
• STP is a loop-prevention protocol.

• allows L2 devices to communicate with each other to discover


physical loops in the network.

• specifies an algorithm that L2 devices can use to create a


loop-free logical topology.

• creates a tree structure of loop-free leaves and branches that


spans the entire Layer 2 network.

3
REDUNDANCY CREATES
LOOPS

4
L2 LOOPS
• Broadcasts
and Layer 2 loops can be a
dangerous combination.

• Ethernet frames have no TTL field

• After
an Ethernet frame starts to loop, it will
probably continue until someone shuts off
one of the switches or breaks a link.
5
L2 LOOPS

Where’s Where’s
Host B? Host B?
FLOOD FLOOD

Uh oh.

6
L2 LOOPS
• Theprevious slide shows the creation of a
feedback loop, which will bring down the
network.
• Also, each switch ends up receiving the frame
(originally from Host A) on two different
ports.
• The switches will flip flop the bridging table
entry for Host A (creating extremely high
CPU utilization). 7
STP PREVENTS LOOPS
• The purpose of STP is to avoid and eliminate
loops in the network by negotiating a loop-
free path through a root bridge.

• STPdetermines where the are loops and


blocks links that are redundant.

• Ensuresthat there will be only one active


path to every destination.
8
SPANNING TREE
ALGORITHM
• STP executes an algorithm called STA.

• STA chooses a reference point, called a root


bridge, and then determines the available
paths to that reference point.

• If
more than two paths exists, STA picks the
best path and blocks the rest

9
BPDUS

• All
switches using STP must exchange Bridge
Protocol Data Units with other switches.

• Sent every 2 seconds on every active port

10
BPDUS
The exchange of BPDU messages results in
the following:

• The election of a root switch

• Theelection of a designated switch for


every switched segment

• The removal of loops in the switched


network by placing redundant switch ports
in a backup state 11
BPDUS
802.3 Header

Destination: 01:80:C2:00:00:00 Mcast 802.1d Bridge group

Source: 00:D0:C0:F5:18:D1

LLC Length: 38

802.2 Logical Link Control (LLC) Header

Dest. SAP: 0x42 802.1 Bridge Spanning Tree

Source SAP: 0x42 802.1 Bridge Spanning Tree

Command: 0x03 Unnumbered Information

802.1 - Bridge Spanning Tree

Protocol Identifier: 0

Protocol Version ID: 0

Message Type: 0 Configuration Message

12
Flags: %00000000
BPDUS

13
WHAT’S A BID?

14
BID
• Consists of two components:

– A 2-byte priority: Cisco switch defaults to 32,768 or 0x8000.

– A 6-byte MAC address

• Used to elect a root bridge.

• Lowest Bridge ID is the root.

• If
all devices have the same priority, the bridge with the lowest
MAC address becomes the root bridge.

15
ELECTING A ROOT BRIDGE
• At startup, a switch assumes that it is the root
bridge and sets the Bridge ID equal to the
Root ID in its BPDUs

• If a switch sees a Root ID lower than its own,


it begins to advertise that Root ID in its
BPDUs.

16
ELECTING A ROOT BRIDGE

17
HOOKING UP WITH THE
ROOT

• Each switch must form an association with the


root bridge.

• Ifa switch receives BPDUs on multiple ports,


then it has a redundant path to the root
bridge (or it is the root bridge!)

18
HOOKING UP WITH THE
ROOT
• In
order to choose which ports will forward
data and which ports will block data, the
switch looks at three components of the
BPDU:

• Lowest path cost to root bridge

• Lowest sender Bridge ID

• Lowest port priority/port ID


19
PATH COST
• Lowest cost path to the root preferred
• Path cost calculated based on link speed and
the number of links that the BPDU crossed
downstream from the root.
• Ifone port has the lowest cost, it is placed in
forwarding mode. All other ports receiving
BPDUs are placed in blocking mode.

20
PATH COST

21
PATH COST

• Youcan tweak the path cost by modifying the


cost of a port.

• Exercise caution when you do this!

22
BRIDGE IDS

• If
the path costs of the received BPDUs are
equal, the switch looks at the Bridge ID to
determine which port should forward.

• The port receiving the lowest Bridge ID is


chosen to forward, all others block.

23
PORT COST/PORT ID
• Ifthe path cost and bridge IDs are equal (as in the case of
parallel links), the switch goes to the port priority as a
tiebreaker.

• Lowest port priority wins (all ports set to 32).

• You can set the priority from 0 – 63.

• If
all ports have the same priority, the port with the lowest
port number forwards frames.

24
PORT ID

0/2

0/1

Assume path cost and port priorities


are default (32). Port ID used in this
case. Port 0/1 would forward
because it’s the lowest.

25
RESULTS OF BPDU
EXCHANGE
• One switch is elected root

• Shortestdistance to the root is calculated for


each switch

•A designated switch is selected.

• This is the switch closest to the root switch


through which frames will be forwarded to
the root. 26
DESIGNATED SWITCH

Designated Switch
Switch A
Root

27
RESULTS OF BPDU
EXCHANGE
•A root port for each switch is selected.
• This is the port that provides the best path
from the switch to the root switch (usually
the lowest-cost path).
• Portsthat will not be forwarding are placed in
the blocked state.
• These ports will continue to send and
receive BPDU information but will not be
allowed to send or receive data.
28
SPANNING-TREE PORT
STATES

29
SPANNING-TREE PORT
STATES

• Blocked: Allports start in blocked mode in


order to prevent the bridge from creating a
bridging loop. The port stays in a blocked state
if Spanning Tree determines that there is a
better path to the root bridge.

30
SPANNING-TREE PORT
STATES
• Listen: Theport transitions from the blocked
state to the listen state

• Attempts to learn whether there are any


other paths to the root bridge

• Listens to frames but cannot send or receive


data, or add to its table.

• Listensfor a period of time called the


forward delay. 31
SPANNING-TREE PORT
STATES
• Learn: The learn state is very similar to the
listen state, except that the port can add
information it has learned to its address table.

• Still not allowed to send or receive data

• Learns for a period of time called the fwd


delay
32
SPANNING-TREE PORT
STATES

• Forward: The port can send and receive data.

•A port is not placed in the forwarding state


unless there are no redundant links or it is
determined that it has the best path to the
root.

33
SPANNING-TREE PORT
STATES

• Disabled: The port is shutdown.

34
SPANNING-TREE PORT
STATES

35
STP TIMERS

36
STP TIMERS
The default value of the forward delay (15
seconds) was originally derived assuming a
maximum network size of seven bridge hops,
a maximum of three lost BPDUs, and a hello-
time interval of 2 seconds.
• Forward delay is used to determine the
length of:
• Listening state
• Learning state 37
STP TIMERS
Max Age is the time that a bridge stores a
BPDU before discarding it.

• Each port saves a copy of the best BPDU it


has seen.

• ifthe device sending this best BPDU fails, it


may take 20 seconds before the a switch
transitions the connected port to Listening.
38
STP TIMERS
• donot change the default timer values
without careful consideration.

• modify the STP timers only from the root


bridge

• theBPDUs contain three fields where the


timer values can be passed from the root
bridge to all other bridges in the network.
39
STP TOPOLOGY CHANGE 1
STP TOPOLOGY CHANGE 2
STP TOPOLOGY CHANGE 3
STP TOPOLOGY CHANGES
• It
can take 30-50 seconds for a network to
converge to a new topology.
• While the network is converging, physical
addresses that can no longer be reached are
still listed in the switch table.
• Because these addresses are in the table, the
switch will attempt to forward frames to
devices it cannot reach.
43
STP TOPOLOGY CHANGES

• The STP change process requires the switch to clear


the table faster in order to get rid of unreachable
physical addresses.

• Ifa switch detects a change, it can send a topology


change BPDU out its root port.

• The topology change BPDU is forwarded to the root switch,


and from there, is propagated throughout the network.
44
CONFIGURING STP

• By default, STP is enabled for every port on


the switch.

• Iffor some reason STP has been disabled, you


can reenable it.

45
CONFIGURING STP (IOS)
Enable Spanning Tree (Enabled by default)

Switch(config)# spantree vlan-list

Configure STP timers

Switch(config)# spanning-tree [vlan vlan-list] [hello-time seconds]

Switch(config)# spanning-tree [vlan vlan-list] [forward-time seconds]

Switch(config)# spanning-tree [vlan vlan-list] [max-age seconds]

46
CONFIGURING STP (IOS)
Configuring Port Cost (to tweak Path Cost)

Switch(config-if) spanning-tree [vlan vlan-list] cost cost

Configuring Bridge Priority (to tweak BID & root election)

Switch(config)# spanning-tree [vlan vlan-list] priority priority

Configuring Port Priority

Switch(config)# spanning-tree [vlan vlan-list] priority priority

47
VERIFYING STP (IOS)

Switch# show spanning-tree [vlan]

Switch# show spanning-tree mod/num

48

Das könnte Ihnen auch gefallen