Bridge learning and the
spanning tree protocol
Bridge learning and the spanning tree protocol
•
Bridge learning
• The way bridges build and maintain the forwarding tables
•
Spanning Tree Protocol (STP)
• Protocol that builds and maintains a logical routing structure for a network of bridges - a spanning tree
•
Bridges and switches are usually synonyms
Networks of bridges and spanning tree routing
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 20 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets active port inactive portForwarding tables
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 20 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E A i2 B i1 C i1 D i1 E i2 A i1 B i1 C i1 D i2 E i1 A i1 B i1 C i1 D i1 E i2 Bridge B1 Router D to other subnets to other subnetsBridge learning
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 30 10 20 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets B i1 B i1Bridge learning
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 30 10 20 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets E i2 E i2 B i1 B i1Spanning Tree Protocol
•
Builds and maintains a logical routing structure for a network of
bridges - a spanning tree
•
Two aspects:
• What are the rules that define the configuration of the spanning tree?
Port costs and bridge identifiers
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets Bridge ID Port costBridge ID
priority MAC address
2 bytes 6 bytes
most significant field
configurable by network manager
one of the MAC addresses of the bridge (typically the lowest one)
Spanning tree configuration
Root bridge: bridge with lowest ID
Cost of path from LAN to root bridge: sum of costs of ports that transmit packets towards root bridge
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets Root bridge Cost of path = 15 Cost of path = 30 Cost of path = 35 Cost of path = 30
Spanning tree configuration
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets Root bridge Cost of path = 15 Cost of path = 10 Cost of path = 25Root bridge: bridge with lowest ID
Cost of path from LAN to root bridge: sum of costs of ports that transmit packets towards root bridge
Spanning tree configuration
Root path cost: cost of shortest (least cost) path from LAN to root
All bridge ports that belong to the shortest paths from each LAN to the root bridge will
become part of the spanning tree… some other ports will also belong Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets
Root path cost from L4 = 15
Root path cost from L3 = 10 Root path cost
from L2 = 0 Root path cost from L1 = 0
Spanning tree configuration
All bridge ports that belong to the shortest paths from each LAN to the root bridge will
become part of the spanning tree… some other ports will also belong
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets
Spanning tree configuration
Designated bridge: bridge that provides lowest cost from LAN to root; root bridge is designated in all LANs it is directly attached to
Designated port: port that provides lowest cost from LAN to root
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets Root bridge Designated bridge @ L1 & L2 Designated bridge @ L4 Designated bridge @ L3 Designated port @ L4 Designated port @ L3 Designated port @ L2 Designated port @ L1
Spanning tree configuration
Root port: bridge port that provides lowest cost to root
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets Root port @ B4 Root port @ B2 Root port @ B3
Spanning tree configuration
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets active port inactive portActive ports (forwarding state): all designated ports and all root ports Inactive ports (blocking state): all other ports
Spanning tree configuration
The inactive ports “are not there” for routing purposes!
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 PC B PC C PC E Bridge B1 Router D to other subnets to other subnets
Spanning tree configuration (bad spanning
tree)
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 10 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 Bridge B1 Router D to other subnets to other subnets Server PC PC PC PC PClots of local traffic in L2
L2 has lots of local traffic. Traffic must be deviated from L2. Here L2 is used as a transit LAN for traffic between L1 or L4 and L3
Spanning tree configuration (good spanning
tree)
L2 has lots of local traffic. Traffic must be deviated from L2. Here L2 is not used as a transit LAN (it is on a leaf of the spanning tree)
Good spanning tree
Bridge B4 Bridge B3 Bridge B2 L2 Router A L1 L4 L3 10 10 20 10 15 10 10 20 20 i1 i1 i2 i2 i2 i1 i2 i3 i1 Bridge B1 Router D to other subnets to other subnets Server PC PC PC PC PC
Spanning Tree Protocol
•
Is a distance vector protocol, with a single distance
–
the distance
to the root bridge
•
Distance vectors are carried in BPDUs (Bridge Protocol Data Units)
• Two types: Configuration BPDUs and Topology Change Notification BPDUs
• Transmitted on multicast address 01:80:c2:00:00:00
•
BPDUs are also used to elect the root bridge
•
Unlike RIP
• Bridges transmit their BPDUs in response to BPDUs sent by other bridges; only the root bridges transmits on its own
Format of control messages
protocol identifier version message type root ID TCA reserved TCroot path cost bridge ID port ID message age max age hello time forward delay
2 octets protocol identifier version message type 1 octet 1 octet 1 octet 8 octets 8 octets 4 octets 2 octets 2 octets 2 octets 2 octets 2 octets 2 octets 1 octet 1 octet Conf - BPDU TCN - BPDU
Configuration BPDUs
•
Message used to configure the spanning tree
•
More important fields:
➢ Root ID (RID): estimate of the root bridge (may be wrong)
➢ Root Path Cost (RPC): estimate of cost of the shortest path to the root bridge (may be wrong) ➢ Bridge ID (BID): bridge that sends the BPDU ➢ Port ID (PID): port that sends the BPDU
Steady-state operation
Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 (1.0.1) (1.10.3) (1 .0 .1 ) (1.20.2) Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 Configuration Vector = (RID, RPC, BID)
Root sends periodically (RID,0,RID) on all ports; other bridges, upon receiving CV on root port, transmit their own CVs on their designated ports
Transient operation
•
Bridges store “best” CVs received so far (called port CVs)
•
Port CVs have a lifetime (called max age)
•
“Best” means lowest RID first, lowest RPC second, lowest BID
third, and lowest PID fourth
Transient operation
•
When there is a change in one port CV, bridge estimates RID and
RPC and recalculates root port and designated ports
• RID: lowest among RIDs of port CVs and its own BID
• RPC: for each port, such that the port RID coincides with the one obtained in previous step, sum the port cost with the RPC of port CV; RPC is the lowest among these values
• Root port: the one that provides the RPC of previous step; if there are several, the one with lowest BID first and lowest PID second wins
• Designated ports: ports where the bridge CV (RID of step 1, RPC of step 2, BID) is better than the port CV
•
With no stored CVs, bridge assumes itself being the root bridge,
Transient operation
RID = 19
RPC = 20 (via i1 or i2)
Root port = i1 (lower BID on port CV) Bridge CV = (19,20,35)
Designated ports = i3 and i4 What are the bridge estimates
and selected ports?
B35 i4 i1 i3 i2 (78,0,78) 10 10 5 10 L2 (19,10,55) (19,15,33) (19,30,81)
Transient operation
RID = 19
RPC = 20 (via i2) Root port = i2
Bridge CV = (19,20,35)
Designated ports = i1, i3 and i4 What are the bridge estimates
and selected ports?
B35 i4 i1 i3 i2 (78,0,78) 10 10 5 10 L2 (19,10,55) (19,15,33) (19,30,81) port CV of i1 reached max age
Transient operation
RID = 19
RPC = 40 (via i3) Root port = i3
Bridge CV = (19,40,35)
Designated ports = i1, i2, and i4 What are the bridge estimates
and selected ports?
B35 i4 i1 i3 i2 (78,0,78) 10 10 5 10 L2 (19,10,55) (19,15,33) (19,30,81) port CVs of i1 and i2 reached max age
Transient operation
RID = 35 RPC = 0
Bridge CV = (35,0,35) Designated ports = all What are the bridge estimates
and selected ports?
B35 i4 i1 i3 i2 (78,0,78) 10 10 5 10 L2 (19,10,55) (19,15,33) (19,30,81)
port CVs of i1, i2 and i3 reached max age
Spanning tree protocol
–
transient operation
(cold start)
Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 (4.0.4) (4.0.4) Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 (2.0.2) (2.0.2) (2.0.2) Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 (4.0.4) (4.0.4) (4.0.4)Spanning tree protocol
–
transient operation
(cold start)
Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 (2.10.3) Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 (2.0.2) (2.0.2) (2.0.2) (2.0.2) (4.0.4) (4.0.4) Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 (1.0.1) (1 .0 .1 ) Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 (2.10.3) (2.0.2) (2.0.2) (2.0.2) (2.0.2) (4.0.4) (4.0.4)Spanning tree protocol
–
transient operation
(cold start)
Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 (1.20.2) (1.20.2) Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 (1.0.1) (1.0.1) (2.10.3) (2.0.2) (2.0.2) (2.0.2) (2.0.2) (4.0.4) (4.0.4) Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 (1.10.3) Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 (1.0.1) (1.0.1) (2.10.3) (1.20.2) (1.20.2) (1.20.2) (2.0.2) (4.0.4) (4.0.4)Spanning tree protocol
–
transient operation
(cold start)
Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 20 20 Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 (1.0.1) (1.0.1) (2.10.3) (1.20.2) (1.10.3) (1.20.2) (2.0.2) (4.0.4) (1.10.3) (1.20.2)Topology change notification process
Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 5 20 Conf-BPDU, TCA=1, TC=1 Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 TCN-BPDU TCN-BPDU Conf-BPDU, TCA=1 Bridge B2 L2 L1 L4 L3 10 10 10 10 20 10 10 5 20 Conf-BPDU, TC=1 Conf-BPDU, TC=1 C o n f-B P D U , T C = 1 Bridge B1 Bridge B3 Bridge B4 i1 i2 i1 i2 i1 i1 i2 i2 i3 Conf-BPDU, TC=1Port states
FORWARDING
LISTENING
LEARNING BLOCKING
• Going from Blocking to Forwarding is delayed to avoid temporary loops (2×forward delay)
• Blocking and Listening: bridge learning and bridge forwarding inhibited
• Learning: bridge learning allowed, bridge forwarding inhibited