07 Spanning Tree - Details - v6 0
07 Spanning Tree - Details - v6 0
LAN Design
Radia Perlman
OriginalCost
Speed [Mbit/s] 802.1D-1998 802.1D-2004
(1000/Speed)
10 100 100 2000000
100 10 19 200000
155 6 14 (129032 ?)
622 1 6 (32154 ?)
1000 1 4 20000
10000 1 2 2000
B-ID 45 B-ID 57
C=10
C=10 C=05
B-ID 42 LAN 5 C=05
C=10
B-ID 83
C=05
LAN 1
C=10
B-ID 97
LAN 3 C=05 C=05 LAN 4
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 12
Spanning Tree Algorithm Summary
• Select the root bridge
– Bridge with the lowest Bridge Identifier
B-ID 83
Root Port C=05
LAN 1
Root Port C=10
Designated Bridge Designated Bridge
for LAN 3 B-ID 97 for LAN 4
LAN 3 Designated Port C=05 C=05 Designated Port LAN 4
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 14
BPDU Format
• Each bridge sends periodically BPDUs carried in
Ethernet multicast frames
– Hello time default: 2 seconds
• Contains all information necessary for building Spanning
Tree
Prot. Prot. BPDU Flags Root ID Root Bridge ID Port ID Msg Max Hello Fwd.
ID Vers. Type (R-ID) Path (O-ID) (P-ID) Age Age Time Delay
Costs
(RPC)
2 Byte 1 Byte 1 Byte 1 Byte 8 Byte 4 Byte 8 Byte 2 Byte 2 Byte 2 Byte 2 Byte 2 Byte
R-ID=45
C=10 Port 2 C=05
RPC=0
B-ID 42 O-ID=45
P-ID=2 R-ID=83
C=05
R-ID=42 C=10 Port 2 RPC=0
R-ID=83
RPC=0 RPC=0
O-ID=83
O-ID=42
P-ID=2
B-ID 83 O-ID=83
P-ID=2 P-ID=1
C=05
C=10 R-ID=97
RPC=0
R-ID=97 O-ID=97
RPC=0 B-ID 97 P-ID=2
O-ID=97
P-ID=1 C=05 C=05
C=10 C=05
R-ID=42
RPC=0
O-ID=42
P-ID=1
B-ID 45 B-ID 57
C=10 Port 1
C=10 C=05
B-ID 42 Root Bridge
C=05
R-ID=42 C=10 Port 2
RPC=0
O-ID=42 B-ID 83
P-ID=2
C=05
C=10
B-ID 97
C=05 C=05
R-ID=42
C=10Root Port R-ID=42
RPC=10 RPC=10
O-ID=97 O-ID=97
P-ID=3 B-ID 97 P-ID=2
C=05 C=05
R-ID=42
C=10 R-ID=42
RPC=10 RPC=10
O-ID=97 O-ID=97
P-ID=3 B-ID 97 P-ID=2
C=05 C=05
R-ID=42
C=10Root Port R-ID=42
RPC=10 RPC=10
O-ID=97 O-ID=97
P-ID=3 B-ID 97 P-ID=2
C=05 C=05
C=10
B-ID 45 B-ID 57
C=10 C=05
BP DP
B-ID 42 LAN 5
BP C=05
C=10
B-ID 83
C=05
LAN 1 RP
B-ID 97
LAN 3 LAN 4
RPC = 10
C=10
B-ID 45 B-ID 57
C=10
BP
B-ID 42 LAN 5
DP C=05
C=10 New
Designated RPC = 5 !!!
Bridge for B-ID 83
LAN 5 C=05
LAN 1 RP
B-ID 97
LAN 3 LAN 4
C=10
B-ID 45 B-ID 57
C=10 C=05
BP DP
B-ID 42 LAN 5
BP C=05
C=10
B-ID 83
C=05
LAN 1 RP
RP
Bridge 2
B-ID 97
LAN 3 DP DP LAN 4
B-ID 83
C=05
LAN 1 DP
RP
B-ID 97
LAN 3 DP DP LAN 4
MAC A
C=10
MAC A B-ID 57
Route DP C=05
B-ID 97
LAN 3 LAN 4
• Time = max age (20 sec) has not to be waited until new
STP is triggered
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 34
STP Convergence Time – Failure of Root
Port - Interruption of Connectivity D->A
LAN 2 MAC D
B-ID 83
C=05
LAN 1 RP
B-ID 97
LAN 3 LAN 4
MAC A
C=10
B-ID 57
Route RP
Bridge B-ID 42 LAN 5 MAC A
C=10 MAC A
TCN to flush MAC entries
in Bridging Table B-ID 83
LAN 1 RP
B-ID 97
LAN 3 LAN 4
• Active paths are always calculated from the root, but the
actual information flow of the network may use other
paths
– Note: network-manager can control this via Bridge Priority, Path Costs
und Port Priority to achieve a certain topology under normal operation
– Hence STP should be designed to overcome plug and play behavior
resulted by default values
• Redundant paths cannot be used for load balancing
– Redundant bridges may be never used if there is no failure of the
currently active components
– For remote bridging via WAN the same is true for redundant WAN
links
• Convergence time between 30 and 50 seconds
– Note: in order to improve convergence time Rapid Spanning Tree
Protocol has been developed (802.1D version 2004)
gi0/2
BID=00-00:00-ca-fe-ba-be-77
Root Path Cost = 0
Root Port or
20s aging over Designated Port
Building Topology Building Bridging Table
Disabled
Lost Designated Link comes up
Port election Administratively down Additional 15 seconds learning state in
order to reduce amount of flooding
when forwarding begins
Cisco: UplinkFast
• STP is completely performed in the Listening state 802.1d defines port roles and states:
– Blocking ports still receive BPDUs (but don‘t send)
Port Roles Port States
• Default convergence time is 30-50 s Root Disabled
– 20s aging, (15+15)s transition time
Designated Blocking
• Timer tuning: Better don't do it !
– Only modify timers of the root bridge Nondesignated Listening
– Don't forget values on supposed backup root bridge Learning
Forwarding
Designated Designated
Port BID=1:MAC_A Port
Cost=19 Cost=19
=> Root Port => Root Port
Default: 32768
2 Bytes 6 Bytes
Bytes
BPDU
Backup root
Root
BPDU BPDU
BPDU
Backup root
Root
BPDU BPDU
MAC B is
at g1/3
g0/1
forwaring state
MAC B
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 52
Cisco Uplink Fast (5):
Actively Correct Tables
• Uplink Fast corrects the bridging tables of upstream bridges
• Sends 15 multicast frames (one every 100 ms) for each MAC
address in its bridging table (i. e. for each downstream hosts)
– Using SA=MAC: All other bridges quickly reconfigure their tables; dead
links are no longer used
– DA=01-00-0C-CD-CD-CD, flooded throughout the network
MAC B is
at g3/17
DA=01-00-0C-CD-CD-CD
SA=MAC B Packet for
MAC B
g1/3 MAC A
Packet for g3/17
MAC B
DA=01-00-0C-CD-CD-CD
SA=MAC B
MAC B
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 53
Cisco Uplink Fast (6):
Additional Details
• When broken link becomes up again, Uplink Fast waits until traffic is
seen
– That is, 30 seconds plus 5 seconds to support other protocols to converge (e.
g. Etherchannel, DTP, …)
• Flapping links would trigger uplink fast too often which causes too
much additional traffic
– Therefore the port is "hold down" for another 35 seconds before Uplink Fast
mechanism is available for that port again
• Several STP parameters are modified automatically
– Bridge Priority = 49152 (don't want to be root)
– All Port Costs += 3000 (don't want to be designated port)
BID=A
BID=A
DP DP
RP RP
AP DP BP
0 1 2 3 4 5 6 7
Forwarding
Learning
P1 P2
2. Agreement
P1 Designated Port
--> Forwarding State
P2 Root Port
Root A B
1. Proposal
P1 P2 P3 P4
2. Agreement
P3 Designated Port
--> Forwarding State
P4 Root Port
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 68
NEW BPDU Handling
• Faster Failure Detection
– BPDUs acting now as keepalives messages
• Different to the 802.1D STP a bridge now sends a BPDU with its
current information every <hello-time> seconds (2 by default),
even if it does not receive any BPDU from the root bridge
– If hellos are not received for 3 consecutive times, port
information is invalidated
• Because BPDU's are now used as keepalive mechanism between
bridges
• If a bridge fails to receive BPDUs from a neighbor, the connection
has been lost
– Max age not used anymore
• For listening and waiting for STP to converge
DP RP
I am root
BPDUs
Root
Root
A
New Spanning Tree
B C
P1
D
1 Root
30 seconds
unreachable
Topology
Change:
New Link!
Root for
Root for VLANs 1-200 VLANs 301-400
Root for
Root for VLANs 1-199 VLANs 300-400
Region C Region B
Region A
• Only the logical STP topologies are shown (not the physical links)
• Each region has internal STP instances (red and blue)
• One CST instance interconnects all regions (black)
WAN-Domain
2 central switches
S1 S2
10GE FO with GEC
LAN-Domain
1GE FO 10GE FO
S1 S2
10GE FO
1GE FO 10GE FO
1GE FO 1GE FO
Root
Bridge
GE CU
FE CU
S1 S2
10GE FO
1GE FO 10GE FO
1GE FO
Root
Bridge
Slower trunks are taken and
GE CU
5 hops must be passed in
FE CU
order to reach the server
Possible packet path for packet
coming from inside
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 101
Spanning Tree Problem Plug & Play 3
S1 S2
10GE FO
1GE FO 10GE FO
1GE FO
Root
Bridge
Slower trunks are taken and
GE CU
4 hops must be passed in
FE CU
order to reach the server
Possible packet path for packet
coming from outside
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 102
Figure Out STP in Complex Scenarios
S1 S2
Root
Bridge
S2
S1
ID = 16 ID = 29
S1 S2
ID = 36
Root ID = 22
Bridge ID = 19 ID = 15 ID = 13
ID = 12
Most trunks of S2
S1 = Root Bridge
10GE FO
are unused
1GE FO 10GE FO
1GE FO 1GE FO
Most trunks of S2
S1 = Root Bridge
are unused
10GE FO with GEC
1GE FO 10GE FO
1GE FO 1GE FO
Mac A
S1 = Root Bridge S2
Red VLAN
Mac A
Mac A
W1 W2 WX WY Mac A F2
F1
Mac A
Mac A
Mac B
S1 S2 = Root Bridge
Mac B Blue VLAN
Mac B Mac B
W1 W2 WX WY F1 F2
Mac B
Mac B
S1 S2
W1 W2 WX WY F1 F2
Mac B
S1 S2
Mac B
Mac B Mac B
W1 W2 WX WY F1 F2
Mac B
Mac B
S1 S2
Mac B
Mac B Mac B
W1 W2 WX WY F1 F2
Mac B Mac A
S1 S2
Mac B
Mac A
W1 W2 WX WY Mac A F2
F1
Mac A
Mac B
Switch W1 is down
Red VLAN is not affected if
PCs are connected to W2
Mac B
S1 S2
Mac B
Mac B Mac B
W2 WX WY F1 F2
Mac B
Switch PC to the other network
outlet of the given VLAN (Blue)
W2, S2 will learn MAC address of
PC with first frame sent by this PC
and trunk of W2-S2 will take the
additional load of this PC
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 117
Link Failure (Access) 1
Mac B
S1 S2
Mac B
Mac B Mac B
W1 W2 WX WY F1 F2
Mac B
Link to W1 is down
Mac B
S1 S2
Mac B
Mac B Mac B
W1 W2 WX WY F1
F1 F2
Mac B
Switch PC to the other network
outlet of the given VLAN (Blue)
W2, S2 will learn MAC address of
PC with first frame sent by this PC
and trunk of W2-S2 will take the
additional load of this PC
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 119
Switch Failure (Central) 1
Mac B
S1 S2
Mac B
Mac B Mac B
W1 W2 WX WY F1 F2
Mac B
Switch S2 is down
Red VLAN is not affected if
PCs are connected to W2
S1
Mac B
Mac B Mac B
Mac B
W1 W2 WX WY F1 F2
Mac B
STP for Blue VLAN will converge to
new root bridge S1;
All trunks will additionally take the
load of all blue PC’s and all
switches will learn MAC address of
blue PC with first frames sent;
special care for WAN traffic !!!
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 121
Trunk Failure (F-Switches) 1
Mac D
S1 S2
Mac D
Mac D
Mac D
W1 W2 WX WY F1 F2
Mac D
Mac D
S1 S2
Mac D
Mac D
Mac D
W1 W2 WX WY F1 F2
Mac D
S1 S2
Mac D
Mac D
Mac D
W1 W2 WX WY F1 F2
Mac D
Switch F2 is down
Red VLAN is not affected
Mac D
S1 S2
Mac D
Mac D
Mac D
W1 W2 WX WY F1
Switch server to the other network
outlet of the given VLAN (Blue);
In the meantime the server is still
reachable via second port!!!
S2 will learn MAC address of
server with first frame sent by this
server and trunk of F1-S2 will
finally take the load to the server
© 2016, D.I. Lindner / D.I. Haas Spanning-Tree Details, v6.0 125
Link Failure (F-Switches) 1
Mac D
S1 S2
Mac D
Mac D
Mac D
W1 W2 WX WY F1 F2
Mac D
Switch F2 is down
Red VLAN is not affected
Mac D
S1 S2
Mac D
Mac D
Mac D
W1 W2 WX WY F1 F2
Mac D
S1 S2
Mac D
Mac D
Mac D
W1 W2 WX WY F1 F2
S1 S2
F1 F2
S1 S2
F1 F2
S1 S2
F1 F2
F1 learns MAC of server’s
blue backup NIC
Server switches to blue backup
NIC – special NIC needed
Outlet for normal
operation
S1 S2
F1 F2
S1 S2
F1 F2
Type-A Type-B
1 server IP address and 1 server MAC 2 server IP addresses and 2 server MAC
address, 1 Default Gateway addresses, 1 Default Gateway, strategy which
NIC to use is necessary
Type-C
Type-D both NIC’s active and
connected to internal router,
both NIC’s active, load balancing via routing
load balancing possible protocol is possible
In case of active / standby it is important that both sides (PC and the switch(es))
have the same sight who is active and who is standby (symmetric view)
Features Modes
Link Aggregation X X X X
source: http://www.intel.com/support/network/sb/cs-009747.htm
S1 S2
W1 W2 WX WY F1 F2
R1 R2
One physical interface:
Router “on a stick”
with 802.1Q Tagging
S1 S2
W1 W2 WX WY F1 F2
WAN-Domain
R1 R2
VLAN Blue
IP Subnet Blue
WAN-Domain
R1 R2
IP: 192.168.1.251/24 IP: 192.168.2.253/24 IP: 192.168.1.252/24 IP: 192.168.2.254/24
Mac: R1_Red Mac: R1_Blue Mac: R2_Red Mac: R2_Blue
IP: 192.168.1.251/24
Mac: R1_Red
IP NET Red: 192.168.1.0/24
IP: 192.168.1.1/24
Mac: S1_Red
R1 R2
Red VLAN: Blue VLAN: Red VLAN: Blue VLAN:
VR_GR_1 VR_GR_3 VR_GR_2 VR_GR_4
SR_GR_2 SR_GR_4 SR_GR_1 SR_GR_3
Default-GW: Default-GW:
VR_GR_1 VR_GR_2
Right Domain
Left Domain Default-GW: Default-GW:
VR_GR_3 VR_GR_4
WAN-Domain
R1 R2
Red VLAN: Blue VLAN: Red VLAN: Blue VLAN:
VR_GR_1 VR_GR_4 SR_GR_1 SR_GR_4
Default-GW: Default-GW:
VR_GR_1 VR_GR_1
Default-GW: Default-GW:
VR_GR_4 VR_GR_4
WAN-Domain
R1 R2
Red VLAN: Blue VLAN:
VR_GR_1 VR_GR_4
Default-GW: Default-GW:
VR_GR_1 VR_GR_1
Default-GW: Default-GW:
VR_GR_4 VR_GR_4
WAN-Domain
R1 R2
Red VLAN: Blue VLAN: Red VLAN: Blue VLAN:
VR_GR_1 SR_GR_4 SR_GR_1 VR_GR_4
Default-GW: Default-GW:
VR_GR_1 VR_GR_1
Default-GW: Default-GW:
VR_GR_4 VR_GR_4
WAN-Domain
R1 R2
Red VLAN: Blue VLAN:
SR_GR_1 VR_GR_4
Default-GW: Default-GW:
VR_GR_1 VR_GR_1
Default-GW: Default-GW:
VR_GR_4 VR_GR_4