Spanning Tree Protocol
Redundancy introduces loops
STP helps prevent loops
Switch Operation: Spanning Tree Protocol
A
B
B3
Extended LANs can have cycles
C B5
D B7
B2 K
E F because either they were built without
B1 global knowledge or for the sake of
G H
having redundant paths between LANs.
B6
B4
I
J
B
B3
C B5 In order to populate forwarding tables
B2
D B7 K so that packets don’t end up looping
forever, first we have to remove cycles
E F
B1
from the network graph and find a
spanning tree.
G H
B6 B4
I
J
Spanning Tree Algorithm : A Loop prevention protocol
Question: How can you find a spanning tree of a graph if you
don’t know the full graph?
Switches exchange BPDU messages
BPDU stands for bridge protocol data unit.
BPDUs are control messages that are exchanged across the switches
within an extended LAN that uses a spanning tree protocol topology.
Bridge ID
Composed of
Bridge Priority - Often default
values
MAC address
Spanning Tree Protocol: BPDU messages
Root Port Selection : Lowest Bridge ID
Spanning Tree Protocol
Next Step:
Root Port Selection
Path Cost
• Bridges use concept of cost to evaluate
how close they are to other bridges
Root Port Selection
A bridge’s root port is the port closest to the
Root Bridge
Switches use cost to determine closeness
Every Non-Root Switch will select one Root
Port
Computing Root Cost
Computing Root Cost
Selecting Root Ports : lowest cost to Root Bridge
Selecting Designated Ports
Opposite end of Root Port are designated
Port – Designated ports are in forwarding
state
Designated ports have least path cost to
the root
If path cost is same, Port with lowest BID
becomes the designated port
Anything not a designated port or a root
port goes into a blocking state
Final Spanning Tree
Token Ring (IEEE 802.5)
Ethernet and the similar protocols are
contention-based protocol
Token ring, token bus are examples of
contention-free protocol
Properties
•The ring is a single, shared medium, not
point to point links in a loop.
• All nodes see all frames.
•A distributed algorithm determines
when a node can transmit.
• Data always flows in one direction.
Basic idea: A token circulates around the ring. When a host has a
frame to transmit, it seizes the token and injects the frame on the
medium. The frame is forwarded by intermediate nodes until
arriving at the destination. The destination puts the frame back
after receiving it, but with a “special mark”. The frame circulates
back to the sender.
Physical Properties
Question: What happens if a node on the ring fails?
Host Host
Host Host As long as a node provides power
to the relay, the relay stays open.
From previous To next From previous To next
host host host host When the node fails, the relay
Relay Relay
closes bypassing the node.
(a) (b)
Host
Multi-Station Access Unit: Several relays
MSAU
packaged together. Multiple MSAUs can be plugged
Host Host together to make a larger network.
From previous
Typical token ring data rates go from 4 Mbps
to 16 Mbps. Number of stations can be as
MSAU
To next
MSAU
Host high as 260.
Token Ring Frame Format
(IEEE 802.5)
8 8 8 48 48 Variable 32 8 8
Start Access Frame Dest Src Body Checksum End Frame
delimiter control control addr addr delimiter status
Switches
Connected to a set of links: each one runs a data-
link (layer 2) protocol.
Primary job: receive incoming frames/packets from
one link and output them to the appropriate link.
Each input or output is a port (bidirectional).
Question: How does a switch decide what output port to use?
Alternatives:
Datagrams, or Connection-less approach
Virtual circuit, or Connection-oriented approach
Source routing.
Datagrams : connectionless networks
Destinati Port
on
Host D
0 Switch 1 Host E
A 3 3 1
Host F
Host C 2 Switch 2
B 0 2 3 1
0
C 3 Host A
D 3
E 2 Host G
1
0 Switch 3
3
Host B
F 1 2
G 0 Host H
H 0 Connectionless: Each datagram is
forwarded on its own.
forwarding table for switch 2
Connectionless Networks
A host can send a packet anywhere, anytime.
When a packet is sent, it is not known
whether the network can deliver it.
Each packet is forwarded independently of
other packets that may have gone to the
same destination.
A switch or link failure is no big deal: an
alternate route can be found and the
forwarding table updated.
Virtual Circuit Switching: Connection
Oriented
0
3 1
Establish a connection 3
0
1 3
0
1 2
between source and 2
Switch 1
2
Switch 2
destination before any
data is communicated. 0
Switch 3
3 1
Host A
Host B
2
Virtual Circuit Table:
Two part process:
• virtual circuit identifier
(1) Connection setup • incoming interface
(2) Data transfer • outgoing interface
• [a different VCI for outgoing packets]
Virtual Circuits
The figure shows a frame
arriving at port 1 with a
VCI of 14.
When the frame arrives,
the switch looks in its table
to find port 1 and a VCI of
14.
When it is found, the
switch knows to change
the VCI to 22 and send out
the frame from port 3.