008 stp principle issue1.3bx1
TRANSCRIPT
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved
www.huawei.com
Internal
ODA040005 STP
Principle
ISSUE 1.3
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 1
Spanning Tree Protocol ( STP ) is applied to
loop network to block some undesirable
redundant paths with certain algorithms and
prune the network into a loop-free tree, thereby
avoiding the proliferation and infinite cycling of
the packet in the loop network
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 2
References
� Clause 8 of IEEE Std 802.1D, 1998
Edition
� Clause 17 of IEEE Std 802.1D, 2004
Edition
� Ethernet Switch Operation Manual
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 3
Upon completion of this course, you
will be able to:
� Understand STP Principle
� Understand RSTP Principle.
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 4
Chapter 1 STP Principle
Chapter 2 RSTP Principle
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 5
Applications Of Transparent Bridge
� Expand LAN scale
� Free and dynamic learning of site address information
� Problem: frames or packets might be forwarded circularly
and continuously, resulting in network congestion
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 6
Broadcast In A Network With Loops
LAN 1
LAN 2
1
1 1 1
2 2 23 33
Site A
Site B
B1 B2 B3
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 7
Why We Need Spanning Tree Protocol?
� Remove path loop that might exist in the bridging network by blocking
redundant links
� Activate redundant backup links to restore network connection when the
current active path fails
ROOTLAN B
LAN C
LAN D
LAN E
LAN A
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 8
Basic Principle Of Spanning Tree Protocol
� Transmits BPDUs (Bridge Protocol Data Unit )among network bridges and
do the following jobs:
�Select the root.
�Calculate the shortest path.
�Select designated bridge.
�Select a root port.
�Select designated ports.
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 9
Contents Of BPDU
� The content of BPDU is organized as (Root ID, Root Path Cost, Designated
Bridge ID, Designated Port ID)
�Root ID: Identifier of root
�Root Path Cost: The smallest path cost from the designated bridge to the
root
�Designated Bridge ID : Identifier of the designated bridge
�Designated Port ID :Identifier of the designated port
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 10
Configuration Message Format
� DMA: Destination MAC Address
� SMA: Source MAC Address
� L/T: Frame length
� LLC Header: Fixed link head of
configuration message
� Payload: BPDU Data
DMA LLC HeaderSMA L/T Payload
Domain Byte
Protocol ID 2
Protocol Version
BPDU Type
Flag Bit
Root Bridge ID
Root Path Cost
Designated Bridge ID
Designated Port ID
Message Age
1
1
1
8
4
8
2
2
Max Age
Hello Time
Forward Delay
2
2
2
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 11
Construct BPDU
� Select the best BPDU from all the BPDUs to construct its own BPDU.
�Select RootID: the RootID of the BPDU with the highest priority
�Calculate Root Path Cost:
− Root Path Cost is the sum of the Root Path Cost of best BPDU and
the cost of the port that receives this BPDU
�Select Root Port:
− The root port is the one that receives the best BPDU
�Select designated port: the ports used to forward the packets
� Send the new BPDU from a designated port
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 12
How To Determine The Best BPDU?
� The best BPDU has the high priority
�Assume there are two configuration messages C1 and C2, then:
− According to Root ID
− If above is the same, According to the Root Path Cost
− If above are the same, According to the Designated Bridge ID
− If above are the same, According to the Port ID
Principle : the smaller, the better
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 13
An Instance Of Receiving And Calculating BPDU
Port 1
Port 2Port 3 Port 4
Port 5
B81
LAN A
B23
Root
B80B100B321
B32
B123
B102
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 14
An Instance Of Receiving And Calculating BPDU
� Select Port4 as the root ,select Port1 and Port2 as designated ports, and
meanwhile block Port3 and Port5.
� Send new BPDU from Port1 and Port2: (23, 15, 81)
�Root ID = 23
�Root Path Cost = 14+1 = 15
�Root Port ID = Port4
�Designated Bridge ID=81
Port 1
Port 2 Port 3 Port 4
Port 5
blocking
blocking
32,,,,0,,,,32 23,,,,18,,,,123 23,,,,14,,,,321 23,,,,14,,,,100 23,,,,15,,,,80
root
23,,,,15,,,,81
B81
23,,,,15,,,,81
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 15
What To Do If Links Fail?
� Hello Time
�The bridge cyclically sends BPDU from a designated port at the period of
Hello Time.
� Message Age and Max Age
�BPDUs stored at a port have a Message Age field, which grows
proportionally with time.
� If there is not BPDU received until the Message Age equals to the Max
Age, the bridge will regard it as failure on the links connected to this port.
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 16
Processing Of Link Fault (I)
� When the message of the BPDU of Port4 is timeout, this BPDU is
abandoned, and a new spanning tree are calculated, so as to select Port3
as the new root port, while the BPDU of bridge 81 remains unchanged
23,,,,18,,,,123
Port 1
Port 2 Port 3 Port 4
Port 5
blocking
23,,,,14,,,,321 23,,,,15,,,,80 23,,,,15,,,,81
root
32,,,,0,,,,32
23,,,,15,,,,81 23,,,,15,,,,81
B81
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 17
Processing Of Link Fault (II)
� When the message of the BPDU of Port3 is timeout, this BPDU is
abandoned, and a new spanning tree are calculated, so as to select Port5 as
the new root port, while the BPDU of bridge 81 changes to (23,16,81)
Port 1
Port 2 Port 3 Port 4
Port 5
23,,,,15,,,,80 23,,,,16,,,,81
root
23,,,,16,,,,81 32,,,,0,,,,32 23,,,,18,,,,123
23,,,,16,,,,81 23,,,,16,,,,81
B81
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 18
Processing Of Link Fault (III)
� When the message of the BPDU of Port5 is timeout, this BPDU is
abandoned, and it is taken itself as the root bridge to send the BPDU
(81,0,81) till a BPDU of a higher priority is received from any port
Port 1
Port 2 Port 3 Port 4
Port 5
81,,,,0,,,,81 81,,,,0,,,,81 81,,,,0,,,,81 81,,,,0,,,,81 81,,,,0,,,,81
B81
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 19
Temporary Loops Or Disconnection
� If the ports at the Forwarding status have not realized that they should stop
forwarding, temporary loops might exist.
� If ports blocked have not realized that they should start forwarding, it might
lead to temporary disconnection.
ROOT
ROOT
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 20
How to avoid temporary loops?
� Forward Delay: Maximum delay for configuration message to be broadcasted
to the whole network
�Design interim status: ports at the interim status merely learns address info
of sites, but does not forward any data
�Ports enter the interim status from the blocked status after the Forward
Delay, then enter the Forwarding status after the Forward Delay
� Ports will go through a certain delay to change from the blocking status to the
forwarding status. This time should at least be twice the forward delay
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 21
Port Status
Port Ability
Not receive/send any messageDisabled
Blocking
Listening
Learning
Port Status
Forwarding
Not receive/forward data, receive but not
transfer BPDUs, and not learn addresses
Not receive/forward data, receive and
transfer BPDUs, but not learn addresses
Not receive/forward data, receive and
transfer BPDUs, and start to learn addresses
Receive and forward data, receive and
transfer BPDUs, and learn addresses
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 22
Port Status Transition
Disabled
Listening
Blocking
Forwarding
Learning
1)interface enabled
2)interface disabled
3)interface is selected as root port or designated port
4)interface is selected as backup interface ( blocking)
5)Forward Delay
((((1)))) ((((2))))
((((1,,,,2))))
((((1,,,,2))))
((((1,,,,2))))((((1))))
((((2))))
((((4))))
((((4)))) ((((5))))
((((4))))
((((5))))((((3))))
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 23
LAN A
Two Timers about the MAC Address Table
� There are two timers used to update the MAC address info:
�A bigger timer is used when the topology is stable
�A smaller timer is used when the topology changes
LAN B
LAN C
LAN E
LAN D
ROOT
B1
B2
B3
B4
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 24
Transmission Of Topology Change Message
ROOT
1
3
2
44
5 5
Topology change notice message
Topology change response message
Topology change message
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 25
Disadvantages of STP
� Recovery time is too long: two Forward Delay
� Network diameter should be less than 7.
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 26
Questions
� What is the working mechanism of STP?
� How to select the best BPDU?
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 27
Chapter 1 STP Principle
Chapter 2 RSTP Principle
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 28
Rapid Spanning Tree Protocol
� The RSTP evolved from the STP, and shares the same basic
concepts;
� RSTP has all functions of STP;
� RSTP can bring down the recovery time interval
when the network topology structure changes
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 29
STP vs. RSTP (Port Types)
STP types of port RSTP types of port
Designated Port Designated Port
Root Port Root Port
Disabled Port Disabled Port
Alternate Port
Backup Port
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 30
STP vs. RSTP (Port States)
STP port state RSTP port state
Disabled Discarding
Blocking Discarding
Listening Discarding
Learning Learning
Forwarding Forwarding
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 31
Improvement Of Rapid Spanning Tree (I)
� A new root port can immediately enter the Forwarding status, if the original
root port has entered the blocked status, and the designated port of the peer
connected to the new root port is in the Forwarding status.
LAN A
TO ROOT
LAN A
LAN A LAN A
F F
F
LAN A LAN A
F F
F
TO ROOT
Designated Port
Root PortBlocked Port Root Port Blocked Port
Designated Port Designated Port Designated Port
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 32
Improvement Of Rapid Spanning Tree (II)
� The designated port can make a handshake with the connected
bridge so as to enter the Forwarding status quickly
LAN B
LAN A
F
1
23
4Handshake request
Handshake response
Designated Port
Root Port
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 33
Attention
� Handshakes must occur on point to point links.
LAN A
LAN B LAN C
LAN A
F
F F
Non Point to Point Links Handshake Diffusion
Designated Port
Designated Port Designated Port
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 34
Improvement Of Rapid Spanning Tree (III)
� The edge ports, i.e., those directly connected to terminals but
not to other bridges can directly enter the forwarding status,
without any delay.
LAN B LAN C
LAN A
Edge Port
LAN DF
TO ROOT
Blocked PortDesignated Port
HUAWEI TECHNOLOGIES CO., LTD. All rights reserved Page 35
Questions
� Tell the port state of RSTP ?
� Describe the three improvements of RSTP in simple words ?